From 112c0632d944114ba2b4eb4875c4f65cd0c261eb Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Sun, 11 Jun 2017 00:51:20 +0200 Subject: tst_QLocale::formattedDataSize: add Russian The table and macros weren't extensible enough for non-Latin-based languages. Change-Id: I950f06de57aaf6bd0b24e0056e4acee2fb655f3d Reviewed-by: Edward Welbourne Reviewed-by: Thiago Macieira --- tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 31 ++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'tests/auto') diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 6132dabeea..2556c7e618 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -2742,6 +2742,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() -- cgit v1.2.3 From 28702cb239b0dbc915ee3511768ff8e366e35e88 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 17 Aug 2018 12:58:01 +0200 Subject: Initialize the QSqlQuery to be invalid when creating a sql model When QSqlQueryModel or QSqlTableModel is created it will create a QSqlQuery which defaults to using the default QSqlDatabase connection. If this connection belongs to another thread then it will throw a warning as this is not safe to use. Since the QSqlQuery is always recreated when a query is set, the instance which is a member of the class can effectively be invalid until a new one is set. Task-number: QTBUG-69213 Change-Id: I68a5dd59fe62788f531d59a0680da11b118ee383 Reviewed-by: Christian Ehrlicher Reviewed-by: Edward Welbourne --- .../models/qsqltablemodel/tst_qsqltablemodel.cpp | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'tests/auto') 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 #include +#include 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" -- cgit v1.2.3 From 546eb7b9473ee78a9ec4167a4f710eb7998f53eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joni=20J=C3=A4ntti?= Date: Tue, 28 Aug 2018 16:23:01 +0300 Subject: Blacklist tst_Gestures on Ubuntu 18.04 These autotests are not currently working with the Ubuntu 18.04 platform being introduced to the CI. Task-number: QTBUG-70227 Task-number: QTBUG-70226 Task-number: QTBUG-70224 Task-number: QTBUG-70223 Task-number: QTBUG-70209 Change-Id: Ibe7cafd37763d7d305d8c3d9ec17bc6339db744a Reviewed-by: Liang Qi --- tests/auto/other/gestures/BLACKLIST | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto') 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 -- cgit v1.2.3