summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/compilerwarnings/test_cpp.txt3
-rw-r--r--tests/auto/compilerwarnings/tst_compilerwarnings.cpp7
-rw-r--r--tests/auto/qdom/tst_qdom.cpp1
-rw-r--r--tests/auto/qstring/tst_qstring.cpp12
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp30
5 files changed, 51 insertions, 2 deletions
diff --git a/tests/auto/compilerwarnings/test_cpp.txt b/tests/auto/compilerwarnings/test_cpp.txt
index 62b35eb..1d317b8 100644
--- a/tests/auto/compilerwarnings/test_cpp.txt
+++ b/tests/auto/compilerwarnings/test_cpp.txt
@@ -58,6 +58,9 @@
#include <QtDBus/QtDBus>
#endif
+#include <QtDeclarative/QtDeclarative>
+
+
#ifndef Q_OS_MAC
int main(int, char **)
{
diff --git a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
index 82c327a..8d344d8 100644
--- a/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
+++ b/tests/auto/compilerwarnings/tst_compilerwarnings.cpp
@@ -114,6 +114,9 @@ void tst_CompilerWarnings::warnings_data()
QTest::addColumn<QStringList>("cflags");
QTest::newRow("standard") << QStringList();
+ QTest::newRow("warn deprecated, fast plus, no debug") << (QStringList() << "-DQT_DEPRECATED_WARNINGS"
+ << "-DQT_USE_FAST_OPERATOR_PLUS" << "-DQT_NU_DEBUG" << "-DQT_NO_DEBUG_STREAM" << "-DQT_NO_WARNING_OUTPUT");
+ QTest::newRow("no deprecated, no keywords") << (QStringList() << "-DQT_NO_DEPRECATED" << "-DQT_NO_KEYWORDS");
#if 0
#ifdef Q_WS_QWS
@@ -136,14 +139,14 @@ void tst_CompilerWarnings::warnings()
QSKIP("gcc 3.x outputs too many bogus warnings", SkipAll);
#endif
- static QString tmpFile;
+ /*static*/ QString tmpFile;
if (tmpFile.isEmpty()) {
QTemporaryFile tmpQFile;
tmpQFile.open();
tmpFile = tmpQFile.fileName();
tmpQFile.close();
}
- static QString tmpSourceFile;
+ /*static*/ QString tmpSourceFile;
bool openResult = true;
const QString tmpBaseName("XXXXXX-test.cpp");
QString templatePath = QDir::temp().absoluteFilePath(tmpBaseName);
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index 0f6cdaa..8bf7620 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -1776,6 +1776,7 @@ void tst_QDom::crashInSetContent() const
QDomImplementation::setInvalidDataPolicy(QDomImplementation::ReturnNullNode);
QDomDocument docImport;
+ QCOMPARE(docImport.setContent(QLatin1String("<a:>text</a:>"), true), false);
QVERIFY(docImport.setContent(QLatin1String("<?xml version=\"1.0\"?><e/>")));
}
diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp
index c887936..ef82769 100644
--- a/tests/auto/qstring/tst_qstring.cpp
+++ b/tests/auto/qstring/tst_qstring.cpp
@@ -208,6 +208,7 @@ private slots:
void repeated_data() const;
void task262677remove();
void QTBUG10404_compareRef();
+ void QTBUG9281_arg_locale();
};
typedef QList<int> IntList;
@@ -4860,6 +4861,17 @@ void tst_QString::QTBUG10404_compareRef()
QVERIFY(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 3), Qt::CaseInsensitive) < 0);
}
+void tst_QString::QTBUG9281_arg_locale()
+{
+ QLocale l(QLocale::English, QLocale::UnitedKingdom);
+ l.setNumberOptions(QLocale::OmitGroupSeparator);
+ QLocale::setDefault(l);
+ QString str("*%L1*%L2*");
+ str = str.arg(123456).arg(1234.56);
+ QCOMPARE(str, QString::fromLatin1("*123456*1234.56*"));
+ QLocale::setDefault(QLocale::C);
+}
+
QTEST_APPLESS_MAIN(tst_QString)
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index f798faf..659ba1a 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -122,6 +122,7 @@ private slots:
void smallTextLengthWrapAtWordBoundaryOrAnywhere();
void testLineBreakingAllSpaces();
void lineWidthFromBOM();
+ void textWidthVsWIdth();
private:
@@ -1359,5 +1360,34 @@ void tst_QTextLayout::glyphLessItems()
}
}
+void tst_QTextLayout::textWidthVsWIdth()
+{
+ QTextLayout layout;
+ QTextOption opt;
+ opt.setWrapMode(QTextOption::WrapAnywhere);
+ layout.setTextOption(opt);
+ layout.setText(QString::fromLatin1(
+ "g++ -c -m64 -pipe -g -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DCORE_LIBRARY -DIDE_LIBRARY_BASENAME=\"lib\" -DWITH_TESTS "
+ "-DQT_NO_CAST_TO_ASCII -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_FAST_CONCATENATION -DQT_PLUGIN -DQT_TESTLIB_LIB -DQT_SCRIPT_LIB -DQT_SVG_LIB -DQT_SQL_LIB -DQT_XM"
+ "L_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../../qt-qml/mkspecs/linux-g++-64 -I. -I../../../../qt-qml/include/QtCore -I../../../."
+ "./qt-qml/include/QtNetwork -I../../../../qt-qml/include/QtGui -I../../../../qt-qml/include/QtXml -I../../../../qt-qml/include/QtSql -I../../../../qt-qml/inc"
+ "lude/QtSvg -I../../../../qt-qml/include/QtScript -I../../../../qt-qml/include/QtTest -I../../../../qt-qml/include -I../../../../qt-qml/include/QtHelp -I../."
+ "./libs -I/home/ettrich/dev/creator/tools -I../../plugins -I../../shared/scriptwrapper -I../../libs/3rdparty/botan/build -Idialogs -Iactionmanager -Ieditorma"
+ "nager -Iprogressmanager -Iscriptmanager -I.moc/debug-shared -I.uic -o .obj/debug-shared/sidebar.o sidebar.cpp"));
+
+ // textWidth includes right bearing, but it should never be LARGER than width if there is space for at least one character
+ for (int width = 100; width < 1000; ++width) {
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ line.setLineWidth(width);
+ layout.endLayout();
+
+ qreal textWidthIsLargerBy = qMax(qreal(0), line.naturalTextWidth() - line.width());
+ qreal thisMustBeZero = 0;
+ QCOMPARE(textWidthIsLargerBy, thisMustBeZero);
+ }
+}
+
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"