diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-08-29 01:00:40 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-08-29 01:00:40 +0200 |
commit | e1c2183374381727e85cbe516e6729b97bff3bf8 (patch) | |
tree | 3c00b1c268ae18382f4befd32dbeb84827780699 /tests | |
parent | 6b4e603c62c71593cadb69fee4cf6e6f4555f7d7 (diff) | |
parent | 546eb7b9473ee78a9ec4167a4f710eb7998f53eb (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: Ifb032dc19053481e1b0ede5c5c72540110d62567
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 31 | ||||
-rw-r--r-- | tests/auto/other/gestures/BLACKLIST | 1 | ||||
-rw-r--r-- | tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp | 47 |
3 files changed, 79 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 011515dcba..4bfaf23d22 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -2744,6 +2744,37 @@ void tst_QLocale::formattedDataSize_data() #undef ROWQ #undef ROWB } + + // Languages which don't use a Latin alphabet + + const QLocale::DataSizeFormats iecFormat = QLocale::DataSizeIecFormat; + const QLocale::DataSizeFormats traditionalFormat = QLocale::DataSizeTraditionalFormat; + const QLocale::DataSizeFormats siFormat = QLocale::DataSizeSIFormat; + const QLocale::Language lang = QLocale::Russian; + + QTest::newRow("Russian-IEC-0") << lang << 2 << iecFormat << 0 << QString("0 \u0431\u0430\u0439\u0442\u044B"); + QTest::newRow("Russian-IEC-10") << lang << 2 << iecFormat << 10 << QString("10 \u0431\u0430\u0439\u0442\u044B"); + // CLDR doesn't provide IEC prefixes (yet?) so they aren't getting translated + QTest::newRow("Russian-IEC-12Ki") << lang << 2 << iecFormat << 12345 << QString("12,06 KiB"); + QTest::newRow("Russian-IEC-16Ki") << lang << 2 << iecFormat << 16384 << QString("16,00 KiB"); + QTest::newRow("Russian-IEC-1235k") << lang << 2 << iecFormat << 1234567 << QString("1,18 MiB"); + QTest::newRow("Russian-IEC-1374k") << lang << 2 << iecFormat << 1374744 << QString("1,31 MiB"); + QTest::newRow("Russian-IEC-1234M") << lang << 2 << iecFormat << 1234567890 << QString("1,15 GiB"); + + QTest::newRow("Russian-Trad-0") << lang << 2 << traditionalFormat << 0 << QString("0 \u0431\u0430\u0439\u0442\u044B"); + QTest::newRow("Russian-Trad-10") << lang << 2 << traditionalFormat << 10 << QString("10 \u0431\u0430\u0439\u0442\u044B"); + QTest::newRow("Russian-Trad-12Ki") << lang << 2 << traditionalFormat << 12345 << QString("12,06 \u043A\u0411"); + QTest::newRow("Russian-Trad-16Ki") << lang << 2 << traditionalFormat << 16384 << QString("16,00 \u043A\u0411"); + QTest::newRow("Russian-Trad-1235k") << lang << 2 << traditionalFormat << 1234567 << QString("1,18 \u041C\u0411"); + QTest::newRow("Russian-Trad-1374k") << lang << 2 << traditionalFormat << 1374744 << QString("1,31 \u041C\u0411"); + QTest::newRow("Russian-Trad-1234M") << lang << 2 << traditionalFormat << 1234567890 << QString("1,15 \u0413\u0411"); + + QTest::newRow("Russian-Decimal-0") << lang << 2 << siFormat << 0 << QString("0 \u0431\u0430\u0439\u0442\u044B"); + QTest::newRow("Russian-Decimal-10") << lang << 2 << siFormat << 10 << QString("10 \u0431\u0430\u0439\u0442\u044B"); + QTest::newRow("Russian-Decimal-16Ki") << lang << 2 << siFormat << 16384 << QString("16,38 \u043A\u0411"); + QTest::newRow("Russian-Decimal-1234k") << lang << 2 << siFormat << 1234567 << QString("1,23 \u041C\u0411"); + QTest::newRow("Russian-Decimal-1374k") << lang << 2 << siFormat << 1374744 << QString("1,37 \u041C\u0411"); + QTest::newRow("Russian-Decimal-1234M") << lang << 2 << siFormat << 1234567890 << QString("1,23 \u0413\u0411"); } void tst_QLocale::formattedDataSize() diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST index 7f36054c6e..ff6d2fa48e 100644 --- a/tests/auto/other/gestures/BLACKLIST +++ b/tests/auto/other/gestures/BLACKLIST @@ -1,5 +1,6 @@ [] rhel-7.4 +ubuntu-18.04 [customGesture] # QTBUG-67254 ubuntu diff --git a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp index 430fa981d5..da31f437d9 100644 --- a/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/sql/models/qsqltablemodel/tst_qsqltablemodel.cpp @@ -31,11 +31,29 @@ #include "../../kernel/qsqldatabase/tst_databases.h" #include <QtSql> #include <QtSql/private/qsqltablemodel_p.h> +#include <QThread> const QString test(qTableName("test", __FILE__, QSqlDatabase())), test2(qTableName("test2", __FILE__, QSqlDatabase())), test3(qTableName("test3", __FILE__, QSqlDatabase())); +// In order to catch when the warning message occurs, indicating that the database belongs to another +// thread, we have to install our own message handler. To ensure that the test reporting still happens +// as before, we call the originating one. +// +// For now, this is only called inside the modelInAnotherThread() test +QtMessageHandler oldHandler = nullptr; + +void sqlTableModelMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + if (type == QtWarningMsg && + msg == "QSqlDatabasePrivate::database: requested database does not " + "belong to the calling thread.") { + QFAIL("Requested database does not belong to the calling thread."); + } + if (oldHandler) + oldHandler(type, context, msg); +} class tst_QSqlTableModel : public QObject { @@ -116,6 +134,7 @@ private slots: void sqlite_bigTable_data() { generic_data("QSQLITE"); } void sqlite_bigTable(); + void modelInAnotherThread(); // bug specific tests void insertRecordBeforeSelect_data() { generic_data(); } @@ -276,6 +295,10 @@ void tst_QSqlTableModel::init() void tst_QSqlTableModel::cleanup() { recreateTestTables(); + if (oldHandler) { + qInstallMessageHandler(oldHandler); + oldHandler = nullptr; + } } void tst_QSqlTableModel::select() @@ -2100,5 +2123,29 @@ void tst_QSqlTableModel::invalidFilterAndHeaderData() QVERIFY(!v.isValid()); } +class SqlThread : public QThread +{ +public: + SqlThread() : QThread() {} + void run() + { + QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "non-default-connection"); + QSqlTableModel stm(nullptr, db); + isDone = true; + } + bool isDone = false; +}; + +void tst_QSqlTableModel::modelInAnotherThread() +{ + oldHandler = qInstallMessageHandler(sqlTableModelMessageHandler); + QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); + CHECK_DATABASE(db); + SqlThread t; + t.start(); + QTRY_VERIFY(t.isDone); + QVERIFY(t.isFinished()); +} + QTEST_MAIN(tst_QSqlTableModel) #include "tst_qsqltablemodel.moc" |