From caa38d217ecbcaaa5617255290598012477c4492 Mon Sep 17 00:00:00 2001 From: Sami Nurmenniemi Date: Mon, 29 May 2017 15:02:40 +0300 Subject: Fix tests for boot2qt The tests for boot2qt were disabled with commit 555750221ee3850ba70169a2b6854041b434c592. The tests can be enabled since qtdeclarative now fallbacks to software renderer if OpenGL is not supported. Changes needed: - Using grabImage does not work correctly on offscreen platform, so tests relying on it are skipped - Extra 1ms delay is needed between two mouse clicks to get rid of test_activeFocusOnPress() flakiness on software quick renderer Change-Id: Ie985110c171bc395bac0d63cd2fbb94207c63516 Reviewed-by: Simon Hausmann --- tests/auto/auto.pro | 3 --- tests/auto/controls/data/tst_combobox.qml | 9 ++++++--- tests/auto/controls/data/tst_tableview.qml | 2 ++ tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp | 6 ++++++ tests/auto/extras/data/tst_picture.qml | 6 ++++++ tests/auto/extras/data/tst_statusindicator.qml | 6 ++++++ 6 files changed, 26 insertions(+), 6 deletions(-) diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index f3b76771..14860dc0 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -2,6 +2,3 @@ TEMPLATE = subdirs SUBDIRS += testplugin controls activeFocusOnTab applicationwindow dialogs \ extras qquicktreemodeladaptor customcontrolsstyle controls.depends = testplugin - -# QTBUG-60268 -boot2qt: SUBDIRS -= controls activeFocusOnTab applicationwindow dialogs extras customcontrolsstyle diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 632a1d15..ce8b6c42 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -512,10 +512,13 @@ TestCase { mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1) verify(!comboBox.activeFocus) comboBox.activeFocusOnPress = true - if (Qt.platform.os === "osx") // on mac when the menu open, the __popup function does not return + if (Qt.platform.os === "osx") { // on macOS when the menu open, the __popup function does not return timer.start() - else // two mouse clicks to open and close the popup menu - mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1) + } else { + // two mouse clicks to open and close the popup menu. The 1ms delay between mouse presses is + // needed with software quick renderer. Without the delay, this test is flaky. + mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1, Qt.LeftButton, Qt.NoModifier, 1) + } mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1) verify(comboBox.activeFocus) comboBox.destroy() diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml index fe50f241..0b54634e 100644 --- a/tests/auto/controls/data/tst_tableview.qml +++ b/tests/auto/controls/data/tst_tableview.qml @@ -971,6 +971,8 @@ TestCase { table.getColumn(0).width = 20 compare(table.getColumn(0).width, 20) table.resizeColumnsToContents() + if (Qt.platform.pluginName === "offscreen") + expectFail("", "QTBUG-62496") compare(table.getColumn(0).width, 50) table.destroy() } diff --git a/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp b/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp index 67aeb586..42354efd 100644 --- a/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp +++ b/tests/auto/customcontrolsstyle/tst_customcontrolsstyle.cpp @@ -68,6 +68,9 @@ void tst_customcontrolsstyle::style_data() void tst_customcontrolsstyle::style() { + if (QGuiApplication::platformName() == "offscreen") + QSKIP("Using grabImage does not work on offscreen platform"); + QFETCH(QString, specifiedStyle); QFETCH(QString, expectedStyleName); @@ -109,6 +112,9 @@ void tst_customcontrolsstyle::style() // start with Base, switch to custom style later on (for a specific QML engine) void tst_customcontrolsstyle::changeStyle() { + if (QGuiApplication::platformName() == "offscreen") + QSKIP("Using grabImage does not work on offscreen platform"); + qputenv("QT_QUICK_CONTROLS_1_STYLE", "Base"); QByteArray importPath = qgetenv("QML2_IMPORT_PATH"); if (importPath.isEmpty()) diff --git a/tests/auto/extras/data/tst_picture.qml b/tests/auto/extras/data/tst_picture.qml index e11d28fb..9ecc89be 100644 --- a/tests/auto/extras/data/tst_picture.qml +++ b/tests/auto/extras/data/tst_picture.qml @@ -107,6 +107,9 @@ TestCase { } function test_source(data) { + if (Qt.platform.pluginName === "offscreen") + skip("Using grabImage does not work on offscreen platform"); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture {}", testCase, ""); verify(picture, "Picture: failed to create an instance"); picture.source = data.tag; @@ -134,6 +137,9 @@ TestCase { } function test_color(data) { + if (Qt.platform.pluginName === "offscreen") + skip("Using grabImage does not work on offscreen platform"); + picture = Qt.createQmlObject("import QtQuick.Extras 1.4; Picture {}", testCase, ""); verify(picture, "Picture: failed to create an instance"); diff --git a/tests/auto/extras/data/tst_statusindicator.qml b/tests/auto/extras/data/tst_statusindicator.qml index 257ec715..8801ead7 100644 --- a/tests/auto/extras/data/tst_statusindicator.qml +++ b/tests/auto/extras/data/tst_statusindicator.qml @@ -90,6 +90,9 @@ TestCase { } function test_active(data) { + if (Qt.platform.pluginName === "offscreen") + skip("Using grabImage does not work on offscreen platform"); + indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); verify(indicator); compare(indicator.active, false); @@ -106,6 +109,9 @@ TestCase { } function test_color() { + if (Qt.platform.pluginName === "offscreen") + skip("Using grabImage does not work on offscreen platform"); + var flatStyle = Settings.styleName === "Flat"; indicator = Qt.createQmlObject("import QtQuick.Extras 1.4; StatusIndicator { }", testCase, ""); -- cgit v1.2.1