From 9eba69d7f914e4823e94699c5653df5ad279eb46 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 21 Jan 2014 08:42:05 +0100 Subject: Fix a bug in some QString comparison operators MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some comparison operators comparing to const char * where not implemented correctly. Task-number: QTBUG-34024 Change-Id: Idbdc64c8ed93e88d9f2b2f55213bc785b33cb543 Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 48874781c0..12fe5259d9 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -4419,6 +4419,62 @@ void tst_QString::operator_smaller() // operator< is not locale-aware (or shouldn't be) QVERIFY( foo < QString("\xc3\xa9") ); QVERIFY( foo < "\xc3\xa9" ); + + QVERIFY(QString("a") < QString("b")); + QVERIFY(QString("a") <= QString("b")); + QVERIFY(QString("a") <= QString("a")); + QVERIFY(QString("a") == QString("a")); + QVERIFY(QString("a") >= QString("a")); + QVERIFY(QString("b") >= QString("a")); + QVERIFY(QString("b") > QString("a")); + + QVERIFY("a" < QString("b")); + QVERIFY("a" <= QString("b")); + QVERIFY("a" <= QString("a")); + QVERIFY("a" == QString("a")); + QVERIFY("a" >= QString("a")); + QVERIFY("b" >= QString("a")); + QVERIFY("b" > QString("a")); + + QVERIFY(QString("a") < "b"); + QVERIFY(QString("a") <= "b"); + QVERIFY(QString("a") <= "a"); + QVERIFY(QString("a") == "a"); + QVERIFY(QString("a") >= "a"); + QVERIFY(QString("b") >= "a"); + QVERIFY(QString("b") > "a"); + + QVERIFY(QLatin1String("a") < QString("b")); + QVERIFY(QLatin1String("a") <= QString("b")); + QVERIFY(QLatin1String("a") <= QString("a")); + QVERIFY(QLatin1String("a") == QString("a")); + QVERIFY(QLatin1String("a") >= QString("a")); + QVERIFY(QLatin1String("b") >= QString("a")); + QVERIFY(QLatin1String("b") > QString("a")); + + QVERIFY(QString("a") < QLatin1String("b")); + QVERIFY(QString("a") <= QLatin1String("b")); + QVERIFY(QString("a") <= QLatin1String("a")); + QVERIFY(QString("a") == QLatin1String("a")); + QVERIFY(QString("a") >= QLatin1String("a")); + QVERIFY(QString("b") >= QLatin1String("a")); + QVERIFY(QString("b") > QLatin1String("a")); + + QVERIFY("a" < QLatin1String("b")); + QVERIFY("a" <= QLatin1String("b")); + QVERIFY("a" <= QLatin1String("a")); + QVERIFY("a" == QLatin1String("a")); + QVERIFY("a" >= QLatin1String("a")); + QVERIFY("b" >= QLatin1String("a")); + QVERIFY("b" > QLatin1String("a")); + + QVERIFY(QLatin1String("a") < "b"); + QVERIFY(QLatin1String("a") <= "b"); + QVERIFY(QLatin1String("a") <= "a"); + QVERIFY(QLatin1String("a") == "a"); + QVERIFY(QLatin1String("a") >= "a"); + QVERIFY(QLatin1String("b") >= "a"); + QVERIFY(QLatin1String("b") > "a"); } void tst_QString::integer_conversion_data() -- cgit v1.2.3 From b5241296f8600ea3ba962c45ed8038abec5343f1 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 4 Dec 2013 14:33:25 +0200 Subject: QDir: Do not assume that root ends with a slash Root can also be "//server" Task-number: QTBUG-35402 Change-Id: I25250b7dcb10cba7b676a0c88b64a402494d7481 Reviewed-by: Friedemann Kleint Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qdir/tst_qdir.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 96be5065d6..2bac6f5834 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1098,6 +1098,10 @@ void tst_QDir::absoluteFilePath_data() QTest::newRow("2") << "/" << "passwd" << "/passwd"; QTest::newRow("3") << "relative" << "path" << QDir::currentPath() + "/relative/path"; QTest::newRow("4") << "" << "" << QDir::currentPath(); +#ifdef Q_OS_WIN + QTest::newRow("5") << "//machine" << "share" << "//machine/share"; +#endif + QTest::newRow("resource") << ":/prefix" << "foo.bar" << ":/prefix/foo.bar"; } -- cgit v1.2.3 From f7ca7ae50ef1e36a85dc3eb8541aaa8907176447 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Thu, 23 Jan 2014 14:50:01 +0100 Subject: Make the QEXPECT_FAIL agree with the QVERIFY2 condition below MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even if the system is not under high load, this test can generate 4 updates on Windows. This is seems to be because the timer actually triggers before its supposed to (sometimes the second start() triggers an update right before the animation is done (at timestamp 399 for instance), forcing it to generate yet another timer event in order to reach the end)). Under high load conditions, too many things can break this test, usually it finishes even before the pause(), causing the QVERIFY(animation.state() == QAbstractAnimation::Paused); to fail. Change-Id: Id94c0d16656675bc6165b7795f3c41a30616a3ba Reviewed-by: Jędrzej Nowacki --- tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp index 529069552b..419fa1af20 100644 --- a/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp +++ b/tests/auto/corelib/animation/qpauseanimation/tst_qpauseanimation.cpp @@ -262,7 +262,7 @@ void tst_QPauseAnimation::pauseResume() QTRY_COMPARE(animation.state(), QAbstractAnimation::Stopped); #ifdef Q_OS_WIN - if (animation.m_updateCurrentTimeCount != 3) + if (animation.m_updateCurrentTimeCount < 3) QEXPECT_FAIL("", winTimerError, Abort); #endif QVERIFY2(animation.m_updateCurrentTimeCount >= 3, qPrintable( -- cgit v1.2.3 From 6894bc0f3f8a579529dc0a7ab869ce565abd06ad Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Fri, 6 Dec 2013 19:00:59 +0100 Subject: Fix sorted QSortFilterProxyModel filter update When changing a filter so that a previously empty proxy model becomes populated sorting was not applied correctly. This was caused by using mapToSource for getting source_sort_column from proxy_sort_column. For an empty proxy model this won't work because no valid proxy index can be created in this case. We now directly use the root index column mapping instead by doing essentially the same as QSortFilterProxyModelPrivate::proxy_to_source but without the sanity checks needed for external use. The sorting feature of QSortFilterProxyModel has always assumed that the number of columns is specified by columnCount(QModelIndex()) so the behavior doesn't change. [ChangeLog][QtCore][QSortFilterProxyModel] Fixed sorting when a previously empty proxy model becomes populated because of a change in the filter. Task-number: QTBUG-30662 Change-Id: I21322122e127889dfadc02f838f0119ed322dcab Reviewed-by: Stephen Kelly --- .../tst_qsortfilterproxymodel.cpp | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 923b9a3a07..c6c81ad75d 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -92,6 +92,7 @@ private slots: void filterTable(); void filterCurrent(); + void filter_qtbug30662(); void changeSourceLayout(); void removeSourceRows_data(); @@ -1480,6 +1481,33 @@ void tst_QSortFilterProxyModel::filterCurrent() QCOMPARE(spy.count(), 2); } +void tst_QSortFilterProxyModel::filter_qtbug30662() +{ + QStringListModel model; + QSortFilterProxyModel proxy; + proxy.setSourceModel(&model); + + // make sure the filter does not match any entry + proxy.setFilterRegExp(QRegExp("[0-9]+")); + + QStringList slSource; + slSource << "z" << "x" << "a" << "b"; + + proxy.setDynamicSortFilter(true); + proxy.sort(0); + model.setStringList(slSource); + + // without fix for QTBUG-30662 this will make all entries visible - but unsorted + proxy.setFilterRegExp(QRegExp("[a-z]+")); + + QStringList slResult; + for (int i = 0; i < proxy.rowCount(); ++i) + slResult.append(proxy.index(i, 0).data().toString()); + + slSource.sort(); + QCOMPARE(slResult, slSource); +} + void tst_QSortFilterProxyModel::changeSourceLayout() { QStandardItemModel model(2, 1); -- cgit v1.2.3 From fdef360bad0f2f1059ff81f1bdd608332541abac Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 28 Jan 2014 07:29:53 -0500 Subject: QFileSelector: correct the macros for Apple platforms. This fixes a serious regression from 7d72516b52b20b0782d972224a55a43e74b8ae5a. [ChangeLog] QFileSelector: the identifier for OS X has been changed back to 'osx' from 'mac', and 'mac' and 'darwin' have now been added as selectors for Darwin OS (which is the base of both OS X and iOS). Task-number: QTBUG-35073 Change-Id: I83183e34c5a697338cc1ddcac33a41bd379ded12 Reviewed-by: Alan Alpert --- tests/auto/corelib/io/qfileselector/platforms/+darwin/test | 0 tests/auto/corelib/io/qfileselector/platforms/+darwin/test2 | 0 tests/auto/corelib/io/qfileselector/platforms/+osx/test2 | 0 .../io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test | 0 .../io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test | 0 .../corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test | 0 .../auto/corelib/io/qfileselector/platforms/+unix/+darwin/test | 0 tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test | 0 tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test | 0 tests/auto/corelib/io/qfileselector/qfileselector.qrc | 10 +++++++--- tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp | 3 ++- 11 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+darwin/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+darwin/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+osx/test2 create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test create mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/test delete mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test delete mode 100644 tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qfileselector/platforms/+darwin/test b/tests/auto/corelib/io/qfileselector/platforms/+darwin/test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+darwin/test2 b/tests/auto/corelib/io/qfileselector/platforms/+darwin/test2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test2 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/test new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+ios/test deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+mac/test deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc index abfead2a55..8fe7b841d2 100644 --- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc +++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc @@ -13,8 +13,10 @@ platforms/test platforms/+unix/+android/test platforms/+unix/+blackberry/test - platforms/+unix/+ios/test - platforms/+unix/+mac/test + platforms/+unix/+darwin/+mac/+ios/test + platforms/+unix/+darwin/+mac/+osx/test + platforms/+unix/+darwin/+mac/test + platforms/+unix/+darwin/test platforms/+windows/+wince/test platforms/+windows/test platforms/+windows/test2 @@ -24,12 +26,14 @@ platforms/+android/test2 platforms/+blackberry/test2 platforms/+ios/test2 - platforms/+mac/test2 + platforms/+osx/test2 platforms/+linux/test2 platforms/+wince/test2 platforms/+android/test platforms/+blackberry/test platforms/+ios/test + platforms/+osx/test + platforms/+darwin/test platforms/+mac/test platforms/+linux/test platforms/+wince/test diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp index d6461c3aba..4ccaecba00 100644 --- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp +++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp @@ -94,7 +94,8 @@ void tst_QFileSelector::basicTest_data() QString test2("/test2"); QString expectedPlatform1File(":/platforms"); QString expectedPlatform2File(""); //Only the last selector -#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) && !defined(Q_OS_IOS) && !defined(Q_OS_LINUX) && !defined(Q_OS_MAC) +#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY) && \ + !defined(Q_OS_DARWIN) && !defined(Q_OS_LINUX) /* We are only aware of specific unixes, and do not have test files for any of the others. However those unixes can get a selector added from the result of a uname call, so this will lead to a case where we don't have that file so we can't expect the concatenation of platform -- cgit v1.2.3