summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp8
-rw-r--r--tests/auto/corelib/tools/qchar/tst_qchar.cpp86
-rw-r--r--tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp6
-rw-r--r--tests/auto/corelib/tools/qlocale/test/test.pro1
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp122
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp10
-rw-r--r--tests/auto/corelib/tools/qtimeline/qtimeline.pro1
-rw-r--r--tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp28
8 files changed, 169 insertions, 93 deletions
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index 267aa71085..e84eb95447 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -170,10 +170,10 @@ static const struct StaticByteArrays {
const char string[8];
} shiftedNotNullTerminated;
-} statics = {{{ Q_REFCOUNT_INITIALIZE_STATIC, /* length = */ 4, 0, 0, sizeof(QByteArrayData) }, "data"}
- ,{{ Q_REFCOUNT_INITIALIZE_STATIC, /* length = */ 4, 0, 0, sizeof(QByteArrayData) }, "dataBAD"}
- ,{{ Q_REFCOUNT_INITIALIZE_STATIC, /* length = */ 4, 0, 0, sizeof(QByteArrayData) + sizeof(char) }, 0, "data"}
- ,{{ Q_REFCOUNT_INITIALIZE_STATIC, /* length = */ 4, 0, 0, sizeof(QByteArrayData) + sizeof(char) }, 0, "dataBAD"}
+} statics = {{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(4), "data"}
+ ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER(4), "dataBAD"}
+ ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(4, sizeof(QByteArrayData) + sizeof(char)), 0, "data"}
+ ,{Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(4, sizeof(QByteArrayData) + sizeof(char)), 0, "dataBAD"}
};
static const QByteArrayDataPtr staticStandard = { const_cast<QByteArrayData *>(&statics.standard.data) };
diff --git a/tests/auto/corelib/tools/qchar/tst_qchar.cpp b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
index 14c43d0088..1a568073cf 100644
--- a/tests/auto/corelib/tools/qchar/tst_qchar.cpp
+++ b/tests/auto/corelib/tools/qchar/tst_qchar.cpp
@@ -276,8 +276,65 @@ void tst_QChar::isLetterOrNumber()
void tst_QChar::isPrint()
{
+ // noncharacters, reserved (General_Gategory =Cn)
+ QVERIFY(!QChar(0x2064).isPrint());
+ QVERIFY(!QChar(0x2069).isPrint());
+ QVERIFY(!QChar(0xfdd0).isPrint());
+ QVERIFY(!QChar(0xfdef).isPrint());
+ QVERIFY(!QChar(0xfff0).isPrint());
+ QVERIFY(!QChar(0xfff8).isPrint());
+ QVERIFY(!QChar(0xfffe).isPrint());
+ QVERIFY(!QChar(0xffff).isPrint());
+/*
+ QVERIFY(!QChar::isPrint(0xe0000u));
+ QVERIFY(!QChar::isPrint(0xe0002u));
+ QVERIFY(!QChar::isPrint(0xe001fu));
+ QVERIFY(!QChar::isPrint(0xe0080u));
+ QVERIFY(!QChar::isPrint(0xe00ffu));
+*/
+
+ // Other_Default_Ignorable_Code_Point, Variation_Selector
+ QVERIFY(QChar(0x034f).isPrint());
+ QVERIFY(QChar(0x115f).isPrint());
+ QVERIFY(QChar(0x180b).isPrint());
+ QVERIFY(QChar(0x180d).isPrint());
+ QVERIFY(QChar(0x3164).isPrint());
+ QVERIFY(QChar(0xfe00).isPrint());
+ QVERIFY(QChar(0xfe0f).isPrint());
+ QVERIFY(QChar(0xffa0).isPrint());
+/*
+ QVERIFY(QChar::isPrint(0xe0100u));
+ QVERIFY(QChar::isPrint(0xe01efu));
+*/
+
+ // Cf, Cs, Cc, White_Space, Annotation Characters
+ QVERIFY(!QChar(0x0008).isPrint());
+ QVERIFY(!QChar(0x000a).isPrint());
+ QVERIFY(QChar(0x0020).isPrint());
+ QVERIFY(QChar(0x00a0).isPrint());
+ QVERIFY(!QChar(0x00ad).isPrint());
+ QVERIFY(!QChar(0x0085).isPrint());
+ QVERIFY(!QChar(0xd800).isPrint());
+ QVERIFY(!QChar(0xdc00).isPrint());
+ QVERIFY(!QChar(0xfeff).isPrint());
+/*
+ QVERIFY(!QChar::isPrint(0x1d173u));
+*/
+
+ QVERIFY(QChar('0').isPrint());
QVERIFY(QChar('A').isPrint());
- QVERIFY(!QChar(0x1aff).isPrint()); // General_Gategory =Cn
+ QVERIFY(QChar('a').isPrint());
+
+ QVERIFY(!QChar(0x0370).isPrint()); // assigned in 5.1
+ QVERIFY(!QChar(0x0524).isPrint()); // assigned in 5.2
+ QVERIFY(!QChar(0x0526).isPrint()); // assigned in 6.0
+ QVERIFY(!QChar(0x08a0).isPrint()); // assigned in 6.1
+ QVERIFY(!QChar(0x1aff).isPrint()); // not assigned
+ QVERIFY(!QChar(0x1e9e).isPrint()); // assigned in 5.1
+/*
+ QVERIFY(!QChar::isPrint(0x1b000u)); // assigned in 6.0
+ QVERIFY(!QChar::isPrint(0x110d0u)); // assigned in 5.1
+*/
}
void tst_QChar::isUpper()
@@ -551,6 +608,14 @@ void tst_QChar::mirroredChar()
void tst_QChar::decomposition()
{
+ // Hangul syllables
+ for (uint ucs = 0xac00; ucs <= 0xd7af; ++ucs) {
+ QChar::Decomposition expected = QChar::unicodeVersion(ucs) > QChar::Unicode_Unassigned ? QChar::Canonical : QChar::NoDecomposition;
+ QString desc = QString::fromLatin1("ucs = 0x%1, tag = %2, expected = %3")
+ .arg(QString::number(ucs, 16)).arg(QChar::decompositionTag(ucs)).arg(expected);
+ QVERIFY2(QChar::decompositionTag(ucs) == expected, desc.toLatin1());
+ }
+
QVERIFY(QChar((ushort)0xa0).decompositionTag() == QChar::NoBreak);
QVERIFY(QChar((ushort)0xa8).decompositionTag() == QChar::Compat);
QVERIFY(QChar((ushort)0x41).decompositionTag() == QChar::NoDecomposition);
@@ -748,6 +813,25 @@ void tst_QChar::normalization_manual()
QVERIFY(composed.normalized(QString::NormalizationForm_KD) == decomposed);
QVERIFY(composed.normalized(QString::NormalizationForm_KC) == decomposed);
}
+ { // hangul
+ QString composed;
+ composed += QChar(0xc154);
+ composed += QChar(0x11f0);
+ QString decomposed;
+ decomposed += QChar(0x1109);
+ decomposed += QChar(0x1167);
+ decomposed += QChar(0x11f0);
+
+ QVERIFY(composed.normalized(QString::NormalizationForm_D) == decomposed);
+ QVERIFY(composed.normalized(QString::NormalizationForm_C) == composed);
+ QVERIFY(composed.normalized(QString::NormalizationForm_KD) == decomposed);
+ QVERIFY(composed.normalized(QString::NormalizationForm_KC) == composed);
+
+ QVERIFY(decomposed.normalized(QString::NormalizationForm_D) == decomposed);
+ QVERIFY(decomposed.normalized(QString::NormalizationForm_C) == composed);
+ QVERIFY(decomposed.normalized(QString::NormalizationForm_KD) == decomposed);
+ QVERIFY(decomposed.normalized(QString::NormalizationForm_KC) == composed);
+ }
}
void tst_QChar::normalizationCorrections()
diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
index 40e3cd08b6..487007e4cf 100644
--- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
+++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp
@@ -526,7 +526,7 @@ void tst_QEasingCurve::properties()
obj.setEasing(inOutBack);
- QEasingCurve easing = qVariantValue<QEasingCurve>(obj.property("easing"));
+ QEasingCurve easing = qvariant_cast<QEasingCurve>(obj.property("easing"));
QCOMPARE(easing.type(), QEasingCurve::InOutBack);
QCOMPARE(easing.overshoot(), overshoot);
QCOMPARE(easing.amplitude(), amplitude);
@@ -538,9 +538,9 @@ void tst_QEasingCurve::properties()
period = linear.period();
obj.setProperty("easing",
- qVariantFromValue(QEasingCurve(QEasingCurve::Linear)));
+ QVariant::fromValue(QEasingCurve(QEasingCurve::Linear)));
- easing = qVariantValue<QEasingCurve>(obj.property("easing"));
+ easing = qvariant_cast<QEasingCurve>(obj.property("easing"));
QCOMPARE(easing.type(), QEasingCurve::Linear);
QCOMPARE(easing.overshoot(), overshoot);
QCOMPARE(easing.amplitude(), amplitude);
diff --git a/tests/auto/corelib/tools/qlocale/test/test.pro b/tests/auto/corelib/tools/qlocale/test/test.pro
index 28e127e307..25023fad4d 100644
--- a/tests/auto/corelib/tools/qlocale/test/test.pro
+++ b/tests/auto/corelib/tools/qlocale/test/test.pro
@@ -16,5 +16,4 @@ win32 {
load(testcase) # for target.path and installTestHelperApp()
installTestHelperApp("../syslocaleapp/syslocaleapp",syslocaleapp,syslocaleapp)
-mac: CONFIG += insignificant_test # QTBUG-22769
win32:CONFIG+= insignificant_test # QTBUG-25284
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 1905c9c049..4ac1221643 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -39,6 +39,16 @@
**
****************************************************************************/
+#ifdef QT_NO_CAST_FROM_ASCII
+# undef QT_NO_CAST_FROM_ASCII
+#endif
+#ifdef QT_NO_CAST_TO_ASCII
+# undef QT_NO_CAST_TO_ASCII
+#endif
+#ifdef QT_ASCII_CAST_WARNINGS
+# undef QT_ASCII_CAST_WARNINGS
+#endif
+
#include <QtTest/QtTest>
#include <qregexp.h>
#include <qregularexpression.h>
@@ -623,7 +633,7 @@ void tst_QString::utf8_data()
QTest::newRow( "str0" ) << QByteArray("abcdefgh")
<< QString("abcdefgh");
QTest::newRow( "str1" ) << QByteArray("\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205")
- << QString("\366\344\374\326\304\334\370\346\345\330\306\305") ;
+ << QString::fromLatin1("\366\344\374\326\304\334\370\346\345\330\306\305") ;
str += QChar( 0x05e9 );
str += QChar( 0x05d3 );
str += QChar( 0x05d2 );
@@ -885,41 +895,11 @@ void tst_QString::constructorQByteArray()
void tst_QString::STL()
{
-#ifndef QT_NO_CAST_TO_ASCII
- QString qt( "QString" );
-
std::string stdstr( "QString" );
- QString stlqt;
-
- // constructor
- stlqt = QString( stdstr );
- QCOMPARE( stlqt, qt );
-
- // assignment
- stlqt = stdstr;
- QCOMPARE( stlqt, qt );
-
- std::string stdstr2 = stlqt;
- QCOMPARE( stdstr2, stdstr );
-
- // prepend
- stlqt = QString();
- stlqt.prepend( stdstr );
- QCOMPARE( stlqt, qt );
-
- // append
- stlqt = QString();
- stlqt.append( stdstr );
- QCOMPARE( stlqt, qt );
-
- // pathologics (null-strings not supported by many STLs, so test only empty strings)
- stdstr = std::string();
- stlqt = stdstr;
- QVERIFY( stlqt.isEmpty() );
- std::string stdstr3 = stlqt;
- QVERIFY( !stdstr3.length() );
-#endif
+ QString stlqt = QString::fromStdString(stdstr);
+ QCOMPARE(stlqt, QString::fromLatin1(stdstr.c_str()));
+ QCOMPARE(stlqt.toStdString(), stdstr);
const wchar_t arr[] = {'h', 'e', 'l', 'l', 'o', 0};
std::wstring stlStr = arr;
@@ -3297,7 +3277,7 @@ void tst_QString::check_QTextIOStream()
a="";
QTextStream ts(&a);
ts << "pi \261= " << 3.125;
- QCOMPARE(a,(QString)"pi \261= 3.125");
+ QCOMPARE(a, QString::fromLatin1("pi \261= 3.125"));
}
{
a="123 456";
@@ -3426,8 +3406,10 @@ void tst_QString::fromUtf8_data()
QTest::newRow("str0") << QByteArray("abcdefgh") << QString("abcdefgh") << -1;
QTest::newRow("str0-len") << QByteArray("abcdefgh") << QString("abc") << 3;
- QTest::newRow("str1") << QByteArray("\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205") << QString("\366\344\374\326\304\334\370\346\345\330\306\305") << -1;
- QTest::newRow("str1-len") << QByteArray("\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205") << QString("\366\344\374\326\304") << 10;
+ QTest::newRow("str1") << QByteArray("\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205")
+ << QString::fromLatin1("\366\344\374\326\304\334\370\346\345\330\306\305") << -1;
+ QTest::newRow("str1-len") << QByteArray("\303\266\303\244\303\274\303\226\303\204\303\234\303\270\303\246\303\245\303\230\303\206\303\205")
+ << QString::fromLatin1("\366\344\374\326\304") << 10;
str += QChar(0x05e9);
str += QChar(0x05d3);
@@ -3474,9 +3456,9 @@ void tst_QString::fromUtf8_data()
QTest::newRow("null5") << QByteArray() << QString() << 5;
QTest::newRow("empty-1") << QByteArray("\0abcd", 5) << QString() << -1;
QTest::newRow("empty0") << QByteArray() << QString() << 0;
- QTest::newRow("empty5") << QByteArray("\0abcd", 5) << QString::fromAscii("\0abcd", 5) << 5;
- QTest::newRow("other-1") << QByteArray("ab\0cd", 5) << QString::fromAscii("ab") << -1;
- QTest::newRow("other5") << QByteArray("ab\0cd", 5) << QString::fromAscii("ab\0cd", 5) << 5;
+ QTest::newRow("empty5") << QByteArray("\0abcd", 5) << QString::fromLatin1("\0abcd", 5) << 5;
+ QTest::newRow("other-1") << QByteArray("ab\0cd", 5) << QString::fromLatin1("ab") << -1;
+ QTest::newRow("other5") << QByteArray("ab\0cd", 5) << QString::fromLatin1("ab\0cd", 5) << 5;
str = "Old Italic: ";
str += QChar(0xd800);
@@ -4390,13 +4372,13 @@ void tst_QString::localeAwareCompare_data()
below.
*/
#ifdef Q_OS_WIN // assume c locale to be english
- QTest::newRow("c1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("\xe5") << QString("\xe4") << 1;
- QTest::newRow("c2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("\xe4") << QString("\xf6") << -1;
- QTest::newRow("c3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString("\xe5") << QString("\xf6") << -1;
+ QTest::newRow("c1") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1;
+ QTest::newRow("c2") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("c3") << MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
#else
- QTest::newRow("c1") << QString("C") << QString("\xe5") << QString("\xe4") << 1;
- QTest::newRow("c2") << QString("C") << QString("\xe4") << QString("\xf6") << -1;
- QTest::newRow("c3") << QString("C") << QString("\xe5") << QString("\xf6") << -1;
+ QTest::newRow("c1") << QString("C") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << 1;
+ QTest::newRow("c2") << QString("C") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("c3") << QString("C") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
#endif
/*
@@ -4422,20 +4404,20 @@ void tst_QString::localeAwareCompare_data()
all come after z.
*/
#ifdef Q_OS_MAC
- QTest::newRow("swedish1") << QString("sv_SE.ISO8859-1") << QString("\xe5") << QString("\xe4") << -1;
- QTest::newRow("swedish2") << QString("sv_SE.ISO8859-1") << QString("\xe4") << QString("\xf6") << -1;
- QTest::newRow("swedish3") << QString("sv_SE.ISO8859-1") << QString("\xe5") << QString("\xf6") << -1;
- QTest::newRow("swedish4") << QString("sv_SE.ISO8859-1") << QString("z") << QString("\xe5") << -1;
+ QTest::newRow("swedish1") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1;
+ QTest::newRow("swedish2") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("swedish3") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("swedish4") << QString("sv_SE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1;
#elif defined(Q_OS_WIN)
- QTest::newRow("swedish1") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString("\xe5") << QString("\xe4") << -1;
- QTest::newRow("swedish2") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString("\xe4") << QString("\xf6") << -1;
- QTest::newRow("swedish3") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString("\xe5") << QString("\xf6") << -1;
- QTest::newRow("swedish4") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString("z") << QString("\xe5") << -1;
+ QTest::newRow("swedish1") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1;
+ QTest::newRow("swedish2") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("swedish3") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("swedish4") << MAKELCID(MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1;
#else
- QTest::newRow("swedish1") << QString("sv_SE") << QString("\xe5") << QString("\xe4") << -1;
- QTest::newRow("swedish2") << QString("sv_SE") << QString("\xe4") << QString("\xf6") << -1;
- QTest::newRow("swedish3") << QString("sv_SE") << QString("\xe5") << QString("\xf6") << -1;
- QTest::newRow("swedish4") << QString("sv_SE") << QString("z") << QString("\xe5") << -1;
+ QTest::newRow("swedish1") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xe4") << -1;
+ QTest::newRow("swedish2") << QString("sv_SE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("swedish3") << QString("sv_SE") << QString::fromLatin1("\xe5") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("swedish4") << QString("sv_SE") << QString::fromLatin1("z") << QString::fromLatin1("\xe5") << -1;
#endif
#if 0
@@ -4443,9 +4425,9 @@ void tst_QString::localeAwareCompare_data()
In Norwegian, ae (E6) comes before o with stroke (D8), which
comes before a with ring above (E5).
*/
- QTest::newRow("norwegian1") << QString("no_NO") << QString("\xe6") << QString("\xd8") << -1;
- QTest::newRow("norwegian2") << QString("no_NO") << QString("\xd8") << QString("\xe5") << -1;
- QTest::newRow("norwegian3") << QString("no_NO") << QString("\xe6") << QString("\xe5") << -1;
+ QTest::newRow("norwegian1") << QString("no_NO") << QString::fromLatin1("\xe6") << QString::fromLatin1("\xd8") << -1;
+ QTest::newRow("norwegian2") << QString("no_NO") << QString::fromLatin1("\xd8") << QString::fromLatin1("\xe5") << -1;
+ QTest::newRow("norwegian3") << QString("no_NO") << QString::fromLatin1("\xe6") << QString::fromLatin1("\xe5") << -1;
#endif
/*
@@ -4453,17 +4435,17 @@ void tst_QString::localeAwareCompare_data()
which comes before o diaresis (F6).
*/
#ifdef Q_OS_MAC
- QTest::newRow("german1") << QString("de_DE.ISO8859-1") << QString("z") << QString("\xe4") << 1;
- QTest::newRow("german2") << QString("de_DE.ISO8859-1") << QString("\xe4") << QString("\xf6") << -1;
- QTest::newRow("german3") << QString("de_DE.ISO8859-1") << QString("z") << QString("\xf6") << 1;
+ QTest::newRow("german1") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1;
+ QTest::newRow("german2") << QString("de_DE.ISO8859-1") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("german3") << QString("de_DE.ISO8859-1") << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1;
#elif defined(Q_OS_WIN)
- QTest::newRow("german1") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString("z") << QString("\xe4") << 1;
- QTest::newRow("german2") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString("\xe4") << QString("\xf6") << -1;
- QTest::newRow("german3") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString("z") << QString("\xf6") << 1;
+ QTest::newRow("german1") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1;
+ QTest::newRow("german2") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("german3") << MAKELCID(MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN), SORT_DEFAULT) << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1;
#else
- QTest::newRow("german1") << QString("de_DE") << QString("z") << QString("\xe4") << 1;
- QTest::newRow("german2") << QString("de_DE") << QString("\xe4") << QString("\xf6") << -1;
- QTest::newRow("german3") << QString("de_DE") << QString("z") << QString("\xf6") << 1;
+ QTest::newRow("german1") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xe4") << 1;
+ QTest::newRow("german2") << QString("de_DE") << QString::fromLatin1("\xe4") << QString::fromLatin1("\xf6") << -1;
+ QTest::newRow("german3") << QString("de_DE") << QString::fromLatin1("z") << QString::fromLatin1("\xf6") << 1;
#endif
}
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
index 556b9ac16a..d0f82a38b7 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -57,6 +57,11 @@
#define UNICODE_LITERAL_EXTRA u"s\u00f6m\u00eb l\u00eft\u00ebr\u00e4l" "EXTRA"
#endif
+#ifndef P
+# error You need to define P
+# define P +
+#endif
+
//fix for gcc4.0: if the operator+ does not exist without QT_USE_FAST_OPERATOR_PLUS
#ifndef QT_USE_FAST_CONCATENATION
#define Q %
@@ -68,7 +73,6 @@ void runScenario()
{
// this code is latin1. TODO: replace it with the utf8 block below, once
// strings default to utf8.
- QLatin1Literal l1literal(LITERAL);
QLatin1String l1string(LITERAL);
QString string(l1string);
QStringRef stringref(&string, 2, 10);
@@ -78,14 +82,10 @@ void runScenario()
QString r3 = QString::fromUtf8(UTF8_LITERAL UTF8_LITERAL);
QString r;
- r = l1literal Q l1literal;
- QCOMPARE(r, r2);
r = string P string;
QCOMPARE(r, r2);
r = stringref Q stringref;
QCOMPARE(r, QString(stringref.toString() + stringref.toString()));
- r = string Q l1literal;
- QCOMPARE(r, r2);
r = string P l1string;
QCOMPARE(r, r2);
r = string Q QStringLiteral(LITERAL);
diff --git a/tests/auto/corelib/tools/qtimeline/qtimeline.pro b/tests/auto/corelib/tools/qtimeline/qtimeline.pro
index cac8074038..3a6c120b5a 100644
--- a/tests/auto/corelib/tools/qtimeline/qtimeline.pro
+++ b/tests/auto/corelib/tools/qtimeline/qtimeline.pro
@@ -2,4 +2,3 @@ CONFIG += testcase parallel_test
TARGET = tst_qtimeline
QT = core testlib
SOURCES = tst_qtimeline.cpp
-win32:CONFIG+=insignificant_test # unstable, QTBUG-24796
diff --git a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
index f05497d7a2..b15de5c1df 100644
--- a/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
+++ b/tests/auto/corelib/tools/qtimeline/tst_qtimeline.cpp
@@ -184,9 +184,10 @@ void tst_QTimeLine::duration()
timeLine.start();
QTest::qWait(999);
QCOMPARE(timeLine.state(), QTimeLine::Running);
- QVERIFY(timeLine.currentTime() > 0.9);
- QTest::qWait(50);
+ QVERIFY(timeLine.currentTime() > 900);
+ QTest::qWait(100);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
+ QCOMPARE(timeLine.currentTime(), 1000);
// The duration shouldn't change
QCOMPARE(timeLine.duration(), 1000);
}
@@ -368,6 +369,8 @@ void tst_QTimeLine::interpolation()
QCOMPARE(timeLine.state(), QTimeLine::Running);
// Smooth accellerates slowly so in the beginning so it is farther behind
+ if (firstValue >= timeLine.currentFrame())
+ QEXPECT_FAIL("", "QTBUG-24796: QTimeLine exhibits inconsistent timing behaviour", Abort);
QVERIFY(firstValue < timeLine.currentFrame());
QTest::qWait(200);
QVERIFY(endValue > timeLine.currentFrame());
@@ -456,24 +459,33 @@ void tst_QTimeLine::toggleDirection()
void tst_QTimeLine::frameChanged()
{
QTimeLine timeLine;
+ timeLine.setCurveShape(QTimeLine::LinearCurve);
timeLine.setFrameRange(0,9);
- timeLine.setUpdateInterval(1000);
+ timeLine.setUpdateInterval(800);
QSignalSpy spy(&timeLine, SIGNAL(frameChanged(int)));
QVERIFY(spy.isValid());
+
+ // Test what happens when duration expires before all frames are emitted.
timeLine.start();
- QTest::qWait(timeLine.duration()*2);
+ QTest::qWait(timeLine.duration()/2);
+ QCOMPARE(timeLine.state(), QTimeLine::Running);
+ QCOMPARE(spy.count(), 0);
+ QTest::qWait(timeLine.duration());
+ if (timeLine.state() != QTimeLine::NotRunning)
+ QEXPECT_FAIL("", "QTBUG-24796: QTimeLine runs slower than it should", Abort);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
- // Probably 10
- QVERIFY(spy.count() <= 10 && spy.count() > 0);
+ if (spy.count() != 1)
+ QEXPECT_FAIL("", "QTBUG-24796: QTimeLine runs slower than it should", Abort);
+ QCOMPARE(spy.count(), 1);
+ // Test what happens when the frames are all emitted well before duration expires.
timeLine.setUpdateInterval(5);
spy.clear();
timeLine.setCurrentTime(0);
timeLine.start();
QTest::qWait(timeLine.duration()*2);
QCOMPARE(timeLine.state(), QTimeLine::NotRunning);
- // Probably 1
- QVERIFY(spy.count() <= 10 && spy.count() > 0);
+ QCOMPARE(spy.count(), 10);
}
void tst_QTimeLine::stopped()