aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-10-20 01:02:53 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-10-20 01:02:53 +0200
commitf06cbeb00b00e54826a67816663920cb468141a2 (patch)
tree9d073663750cfaf11ace6488f880be093b40b2bd /tests/auto/qml
parenteef179c9eb2c2d24e67c27742618555267e45e89 (diff)
parent6734ee9a6ddb6a3870556514a70d904836258559 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Diffstat (limited to 'tests/auto/qml')
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/data/sortdir/Uppercase.txt0
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/data/sortdir/lowercase.txt0
-rw-r--r--tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp45
-rw-r--r--tests/auto/qml/v4misc/tst_v4misc.cpp1
4 files changed, 39 insertions, 7 deletions
diff --git a/tests/auto/qml/qquickfolderlistmodel/data/sortdir/Uppercase.txt b/tests/auto/qml/qquickfolderlistmodel/data/sortdir/Uppercase.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/data/sortdir/Uppercase.txt
diff --git a/tests/auto/qml/qquickfolderlistmodel/data/sortdir/lowercase.txt b/tests/auto/qml/qquickfolderlistmodel/data/sortdir/lowercase.txt
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/tests/auto/qml/qquickfolderlistmodel/data/sortdir/lowercase.txt
diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
index 77fda3b555..4b2ae45bae 100644
--- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
+++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp
@@ -73,7 +73,8 @@ private slots:
void showDotAndDotDot_data();
void sortReversed();
void introspectQrc();
-
+ void sortCaseSensitive_data();
+ void sortCaseSensitive();
private:
void checkNoErrors(const QQmlComponent& component);
QQmlEngine engine;
@@ -126,7 +127,7 @@ void tst_qquickfolderlistmodel::basicProperties()
QSignalSpy folderChangedSpy(flm, SIGNAL(folderChanged()));
flm->setProperty("folder", dataDirectoryUrl());
QVERIFY(folderChangedSpy.wait());
- QCOMPARE(flm->property("count").toInt(), 8);
+ QCOMPARE(flm->property("count").toInt(), 9);
QCOMPARE(flm->property("folder").toUrl(), dataDirectoryUrl());
QCOMPARE(flm->property("parentFolder").toUrl(), QUrl::fromLocalFile(QDir(directory()).canonicalPath()));
QCOMPARE(flm->property("sortField").toInt(), int(Name));
@@ -166,12 +167,12 @@ void tst_qquickfolderlistmodel::showFiles()
QVERIFY(flm != nullptr);
flm->setProperty("folder", dataDirectoryUrl());
- QTRY_COMPARE(flm->property("count").toInt(), 8); // wait for refresh
+ QTRY_COMPARE(flm->property("count").toInt(), 9); // wait for refresh
QCOMPARE(flm->property("showFiles").toBool(), true);
flm->setProperty("showFiles", false);
QCOMPARE(flm->property("showFiles").toBool(), false);
- QTRY_COMPARE(flm->property("count").toInt(), 2); // wait for refresh
+ QTRY_COMPARE(flm->property("count").toInt(), 3); // wait for refresh
}
void tst_qquickfolderlistmodel::resetFiltering()
@@ -238,7 +239,7 @@ void tst_qquickfolderlistmodel::refresh()
QVERIFY(flm != nullptr);
flm->setProperty("folder", dataDirectoryUrl());
- QTRY_COMPARE(flm->property("count").toInt(),8); // wait for refresh
+ QTRY_COMPARE(flm->property("count").toInt(), 9); // wait for refresh
int count = flm->rowCount();
@@ -342,7 +343,7 @@ void tst_qquickfolderlistmodel::showDotAndDotDot()
flm->setProperty("rootFolder", rootFolder);
flm->setProperty("showDotAndDotDot", showDotAndDotDot);
- int count = 9;
+ int count = 10;
if (showDot) count++;
if (showDotDot) count++;
QTRY_COMPARE(flm->property("count").toInt(), count); // wait for refresh
@@ -373,7 +374,7 @@ void tst_qquickfolderlistmodel::sortReversed()
QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
QVERIFY(flm != nullptr);
flm->setProperty("folder", dataDirectoryUrl());
- QTRY_COMPARE(flm->property("count").toInt(), 9); // wait for refresh
+ QTRY_COMPARE(flm->property("count").toInt(), 10); // wait for refresh
QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("txtdir"));
}
@@ -387,6 +388,36 @@ void tst_qquickfolderlistmodel::introspectQrc()
QCOMPARE(flm->data(flm->index(0),FileNameRole).toString(), QLatin1String("hello.txt"));
}
+void tst_qquickfolderlistmodel::sortCaseSensitive_data()
+{
+ QTest::addColumn<bool>("sortCaseSensitive");
+ QTest::addColumn<QStringList>("expectedOrder");
+
+ const QString upperFile = QLatin1String("Uppercase.txt");
+ const QString lowerFile = QLatin1String("lowercase.txt");
+
+ QTest::newRow("caseSensitive") << true << (QStringList() << upperFile << lowerFile);
+ QTest::newRow("caseInsensitive") << false << (QStringList() << lowerFile << upperFile);
+}
+
+void tst_qquickfolderlistmodel::sortCaseSensitive()
+{
+ QFETCH(bool, sortCaseSensitive);
+ QFETCH(QStringList, expectedOrder);
+ QQmlComponent component(&engine);
+ component.setData("import Qt.labs.folderlistmodel 1.0\n"
+ "FolderListModel { }", QUrl());
+ checkNoErrors(component);
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+ flm->setProperty("folder", QUrl::fromLocalFile(dataDirectoryUrl().path() + QLatin1String("/sortdir")));
+ flm->setProperty("sortCaseSensitive", sortCaseSensitive);
+ QTRY_COMPARE(flm->property("count").toInt(), 2); // wait for refresh
+ for (int i = 0; i < 2; ++i)
+ QTRY_COMPARE(flm->data(flm->index(i),FileNameRole).toString(), expectedOrder.at(i));
+}
+
QTEST_MAIN(tst_qquickfolderlistmodel)
#include "tst_qquickfolderlistmodel.moc"
diff --git a/tests/auto/qml/v4misc/tst_v4misc.cpp b/tests/auto/qml/v4misc/tst_v4misc.cpp
index f8e76fdf5c..da7b610978 100644
--- a/tests/auto/qml/v4misc/tst_v4misc.cpp
+++ b/tests/auto/qml/v4misc/tst_v4misc.cpp
@@ -114,6 +114,7 @@ void tst_v4misc::parserMisc_data()
QTest::newRow("for (var f in ++!binaryMathg) ;") << QString("ReferenceError: Prefix ++ operator applied to value that is not a reference.");
QTest::newRow("for (va() in obj) {}") << QString("ReferenceError: Invalid left-hand side expression for 'in' expression");
QTest::newRow("[1]=7[A=8=9]") << QString("ReferenceError: left-hand side of assignment operator is not an lvalue");
+ QTest::newRow("var asmvalsLen = asmvals{{{{{ngth}}}}};") << QString("SyntaxError: Expected token `;'");
}
void tst_v4misc::parserMisc()