diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-11-15 01:00:11 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2019-11-15 16:30:51 +0100 |
commit | 5abb976f23ef0f3cbb7b720e523c08d768c76c0e (patch) | |
tree | 55fece450d39fdaf2fb2e213fc321fcf936a18cb /tests | |
parent | 76a0f94a6d7d85f352e3d4a00c192bfc377cc776 (diff) | |
parent | adc7bbe910a4b89a579ffa93da5a937cfc1379f4 (diff) |
Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/time/qtimezone/BLACKLIST | 12 | ||||
-rw-r--r-- | tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp | 36 | ||||
-rw-r--r-- | tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp | 14 | ||||
-rw-r--r-- | tests/libfuzzer/gui/iccparser/main.cpp | 4 | ||||
-rw-r--r-- | tests/manual/diaglib/nativewindowdump_win.cpp | 71 |
5 files changed, 127 insertions, 10 deletions
diff --git a/tests/auto/corelib/time/qtimezone/BLACKLIST b/tests/auto/corelib/time/qtimezone/BLACKLIST index 840c3b1181..b820bab3d9 100644 --- a/tests/auto/corelib/time/qtimezone/BLACKLIST +++ b/tests/auto/corelib/time/qtimezone/BLACKLIST @@ -2,10 +2,6 @@ [dataStreamTest] android -# QTBUG-69128 -[isTimeZoneIdAvailable] -android - # QTBUG-69129 [specificTransition] android @@ -75,10 +71,14 @@ android android [transitionEachZone:Asia/Chita@1970] android +[transitionEachZone:Asia/Choibalsan@1970] +android [transitionEachZone:Asia/Dushanbe@1970] android [transitionEachZone:Asia/Ho_Chi_Minh@1970] android +[transitionEachZone:Asia/Hovd@1970] +android [transitionEachZone:Asia/Kathmandu@1970] android [transitionEachZone:Asia/Katmandu@1970] @@ -109,6 +109,10 @@ android android [transitionEachZone:Asia/Thimphu@1970] android +[transitionEachZone:Asia/Ulaanbaatar@1970] +android +[transitionEachZone:Asia/Ulan_Bator@1970] +android [transitionEachZone:Asia/Ust-Nera@1970] android [transitionEachZone:Atlantic/Cape_Verde@1970] diff --git a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp index 5b1bde8ea3..d0ef8023b9 100644 --- a/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp @@ -818,6 +818,10 @@ void tst_QTimeZone::isValidId_data() QTest::addColumn<QByteArray>("input"); QTest::addColumn<bool>("valid"); + // a-z, A-Z, 0-9, '.', '-', '_' are valid chars + // Can't start with '-' + // Parts separated by '/', each part min 1 and max of 14 chars + // (Android has parts with lengths up to 17, so tolerates this as a special case.) #define TESTSET(name, section, valid) \ QTest::newRow(name " front") << QByteArray(section "/xyz/xyz") << valid; \ QTest::newRow(name " middle") << QByteArray("xyz/" section "/xyz") << valid; \ @@ -828,11 +832,16 @@ void tst_QTimeZone::isValidId_data() // Parts separated by '/', each part min 1 and max of 14 chars TESTSET("empty", "", false); TESTSET("minimal", "m", true); +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) + TESTSET("maximal", "East-Saskatchewan", true); // Android actually uses this + TESTSET("too long", "North-Saskatchewan", false); // ... but thankfully not this. +#else TESTSET("maximal", "12345678901234", true); TESTSET("maximal twice", "12345678901234/12345678901234", true); TESTSET("too long", "123456789012345", false); TESTSET("too-long/maximal", "123456789012345/12345678901234", false); TESTSET("maximal/too-long", "12345678901234/123456789012345", false); +#endif TESTSET("bad hyphen", "-hyphen", false); TESTSET("good hyphen", "hy-phen", true); @@ -879,6 +888,31 @@ void tst_QTimeZone::isValidId_data() TESTSET("invalid char ' '", " ", false); #undef TESTSET + + QTest::newRow("az alone") << QByteArray("az") << true; + QTest::newRow("AZ alone") << QByteArray("AZ") << true; + QTest::newRow("09 alone") << QByteArray("09") << true; + QTest::newRow("a/z alone") << QByteArray("a/z") << true; + QTest::newRow("a.z alone") << QByteArray("a.z") << true; + QTest::newRow("a-z alone") << QByteArray("a-z") << true; + QTest::newRow("a_z alone") << QByteArray("a_z") << true; + QTest::newRow(".z alone") << QByteArray(".z") << true; + QTest::newRow("_z alone") << QByteArray("_z") << true; + QTest::newRow("a z alone") << QByteArray("a z") << false; + QTest::newRow("a\\z alone") << QByteArray("a\\z") << false; + QTest::newRow("a,z alone") << QByteArray("a,z") << false; + QTest::newRow("/z alone") << QByteArray("/z") << false; + QTest::newRow("-z alone") << QByteArray("-z") << false; +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) + QTest::newRow("long alone") << QByteArray("12345678901234567") << true; + QTest::newRow("over-long alone") << QByteArray("123456789012345678") << false; +#else + QTest::newRow("long alone") << QByteArray("12345678901234") << true; + QTest::newRow("over-long alone") << QByteArray("123456789012345") << false; +#endif + +#else + QSKIP("This test requires a Qt -developer-build."); #endif // QT_BUILD_INTERNAL } @@ -889,8 +923,6 @@ void tst_QTimeZone::isValidId() QFETCH(bool, valid); QCOMPARE(QTimeZonePrivate::isValidId(input), valid); -#else - QSKIP("This test requires a Qt -developer-build."); #endif } diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index dcffe8043b..9750a31824 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp @@ -2868,6 +2868,7 @@ public: }; Node *root; + bool crash = false; EvilModel(QObject *parent = nullptr): QAbstractItemModel(parent), root(new Node) {} @@ -2876,6 +2877,11 @@ public: delete root; } + void setCrash() + { + crash = true; + } + void change() { emit layoutAboutToBeChanged(); @@ -2944,6 +2950,10 @@ public: QVariant data(const QModelIndex &idx, int role) const override { + if (crash) { + QTest::qFail("Should not get here...", __FILE__, __LINE__); + return QVariant(); + } if (idx.isValid() && role == Qt::DisplayRole) { Node *parentNode = root; if (idx.isValid()) { @@ -2963,6 +2973,7 @@ void tst_QTreeView::evilModel_data() { QTest::addColumn<bool>("visible"); QTest::newRow("visible") << false; + QTest::newRow("visible") << true; } void tst_QTreeView::evilModel() @@ -3132,6 +3143,9 @@ void tst_QTreeView::evilModel() model.change(); view.setRootIndex(secondLevel); + + model.setCrash(); + view.setModel(nullptr); } void tst_QTreeView::indexRowSizeHint() diff --git a/tests/libfuzzer/gui/iccparser/main.cpp b/tests/libfuzzer/gui/iccparser/main.cpp index 1db43d2e25..7681c1468e 100644 --- a/tests/libfuzzer/gui/iccparser/main.cpp +++ b/tests/libfuzzer/gui/iccparser/main.cpp @@ -29,6 +29,10 @@ #include <QGuiApplication> #include <QColorSpace> +// Run this with +// QT_LOGGING_RULES="qt.gui.icc=false" +// to reduce noise and increase speed. + extern "C" int LLVMFuzzerTestOneInput(const char *data, size_t size) { static int c = 0; static QGuiApplication a(c, nullptr); diff --git a/tests/manual/diaglib/nativewindowdump_win.cpp b/tests/manual/diaglib/nativewindowdump_win.cpp index aae8746413..d91e673d1c 100644 --- a/tests/manual/diaglib/nativewindowdump_win.cpp +++ b/tests/manual/diaglib/nativewindowdump_win.cpp @@ -32,6 +32,7 @@ #include <QtCore/QTextStream> #include <QtCore/QSharedPointer> #include <QtCore/QDebug> +#include <QtCore/QRect> #include <QtCore/QVector> #include <QtCore/qt_windows.h> @@ -54,14 +55,76 @@ struct DumpContext { if (style & styleConstant) \ str << ' ' << #styleConstant; +static QTextStream &operator<<(QTextStream &str, const QPoint &p) +{ + str << p.x() << ", " << p.y(); + return str; +} + +static QTextStream &operator<<(QTextStream &str, const QSize &s) +{ + str << s.width() << 'x' << s.height(); + return str; +} + +static QTextStream &operator<<(QTextStream &str, const QRect &rect) +{ + str << rect.size() << forcesign << rect.x() << rect.y() << noforcesign; + return str; +} + +static inline QSize qsizeFromRECT(const RECT &rect) +{ + return QSize(rect.right -rect.left, rect.bottom - rect.top); +} + +static inline QRect qrectFromRECT(const RECT &rect) +{ + return QRect(QPoint(rect.left, rect.top), qsizeFromRECT(rect)); +} + +static QRect getFrameGeometry(HWND hwnd) +{ + RECT rect; + return GetWindowRect(hwnd, &rect) ? qrectFromRECT(rect) : QRect(); +} + +static QPoint getClientAreaScreenPos(HWND hwnd) +{ + POINT clientPos{0, 0}; + return ClientToScreen(hwnd, &clientPos) ? QPoint(clientPos.x, clientPos.y) : QPoint(); +} + +static QRect getClientAreaGeometry(HWND hwnd) +{ + RECT clientRect; + return GetClientRect(hwnd, &clientRect) + ? QRect(getClientAreaScreenPos(hwnd), qsizeFromRECT(clientRect)) : QRect(); +} + +static bool isTopLevel(HWND hwnd) +{ + auto parent = GetParent(hwnd); + return !parent || parent == GetDesktopWindow(); +} + static void formatNativeWindow(HWND hwnd, QTextStream &str) { str << hex << showbase << quintptr(hwnd) << noshowbase << dec; - RECT rect; - if (GetWindowRect(hwnd, &rect)) { - str << ' ' << (rect.right - rect.left) << 'x' << (rect.bottom - rect.top) - << forcesign << rect.left << rect.top << noforcesign; + + const bool topLevel = isTopLevel(hwnd); + if (topLevel) + str << " [top]"; + const auto frameGeometry = getFrameGeometry(hwnd); + const auto clientGeometry = getClientAreaGeometry(hwnd); + str << ' ' << frameGeometry; + if (!topLevel) + str << " local: " << (clientGeometry.topLeft() - getClientAreaScreenPos(GetParent(hwnd))); + if (clientGeometry != frameGeometry) { + str << " client: " << clientGeometry << " frame: " + << (clientGeometry.topLeft() - frameGeometry.topLeft()); } + if (IsWindowVisible(hwnd)) str << " [visible]"; |