From 7d001497ddcda501c55aac35b4c7a60980d9c6b5 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 6 May 2019 17:04:27 +0200 Subject: Fix flaky tst_qquickmenu test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The important part of the "cascading" test is checking that the sub-sub menu eventually opens, so move the !visible check to the non-cascading branch of the if statement. Change-Id: I5a09bf0b5d45832f7b75c3e8c397fdb9e6fcc011 Reviewed-by: Richard Moe Gustavsen Reviewed-by: Jüri Valdmann --- tests/auto/qquickmenu/tst_qquickmenu.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/qquickmenu/tst_qquickmenu.cpp b/tests/auto/qquickmenu/tst_qquickmenu.cpp index 49fdc066..f22ac972 100644 --- a/tests/auto/qquickmenu/tst_qquickmenu.cpp +++ b/tests/auto/qquickmenu/tst_qquickmenu.cpp @@ -1105,8 +1105,9 @@ void tst_QQuickMenu::subMenuMouse() QCOMPARE(mainMenu->isVisible(), cascade); QVERIFY(subMenu1->isVisible()); QVERIFY(!subMenu2->isVisible()); - QVERIFY(!subSubMenu1->isVisible()); - if (cascade) { + if (!cascade) { + QVERIFY(!subSubMenu1->isVisible()); + } else { QTRY_VERIFY(subSubMenu1->isVisible()); QTRY_VERIFY(subSubMenu1->isOpened()); } -- cgit v1.2.3 From 9310d5fb5285ae5eb4b94c01606791319b775b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCri=20Valdmann?= Date: Mon, 6 May 2019 14:09:11 +0200 Subject: Container: Keep currentIndex at 0 when removing item 0 if possible Current behavior is to always decrement the currentIndex when the current item is removed -- even when the current item is item 0. This means, for example, that in a TabBar with three tabs and the first tab selected closing the first tab will leave nothing at all selected. Change behavior to keep currentIndex at 0 if there are still items left in the container. Now closing the first tab will leave the next remaining tab selected. Change-Id: If4e1903366e29fcee8226b776d5b2e03cec189df Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_tabbar.qml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml index 519b1d53..42e767f2 100644 --- a/tests/auto/controls/data/tst_tabbar.qml +++ b/tests/auto/controls/data/tst_tabbar.qml @@ -270,6 +270,29 @@ TestCase { compare(contentChildrenSpy.count, 12) } + function test_removeCurrent() { + var control = createTemporaryObject(tabBar, testCase) + + control.addItem(tabButton.createObject(control, {text: "1"})) + control.addItem(tabButton.createObject(control, {text: "2"})) + control.addItem(tabButton.createObject(control, {text: "3"})) + control.currentIndex = 1 + compare(control.count, 3) + compare(control.currentIndex, 1) + + control.removeItem(1) + compare(control.count, 2) + compare(control.currentIndex, 0) + + control.removeItem(0) + compare(control.count, 1) + compare(control.currentIndex, 0) + + control.removeItem(0) + compare(control.count, 0) + compare(control.currentIndex, -1) + } + Component { id: contentBar TabBar { -- cgit v1.2.3 From 7431b0549a9bb69f5f4a036fc931683dd4e20d2c Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 14 May 2019 10:51:35 +0200 Subject: tst_accessibility: Simplify role verification Instead of casting to int and back to enum, just use the enum directly. Change-Id: Ifbd6a74ee499ffaeb99b0b4274cd59365833bfbd Reviewed-by: Liang Qi --- tests/auto/accessibility/tst_accessibility.cpp | 100 ++++++++++++------------- 1 file changed, 50 insertions(+), 50 deletions(-) (limited to 'tests') diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 7e491b54..0224f020 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -64,56 +64,56 @@ private: void tst_accessibility::a11y_data() { QTest::addColumn("name"); - QTest::addColumn("role"); + QTest::addColumn("role"); QTest::addColumn("text"); - QTest::newRow("AbstractButton") << "abstractbutton" << 0x0000002B << "AbstractButton"; //QAccessible::Button - QTest::newRow("BusyIndicator") << "busyindicator" << 0x00000027 << ""; //QAccessible::Indicator - QTest::newRow("Button") << "button" << 0x0000002B << "Button"; //QAccessible::Button - QTest::newRow("CheckBox") << "checkbox" << 0x0000002C << "CheckBox"; //QAccessible::CheckBox - QTest::newRow("CheckDelegate") << "checkdelegate" << 0x0000002C << "CheckDelegate"; //QAccessible::CheckBox - QTest::newRow("ComboBox") << "combobox" << 0x0000002E << "ComboBox"; //QAccessible::ComboBox - QTest::newRow("Container") << "container" << 0x00000000 << ""; //QAccessible::NoRole - QTest::newRow("Control") << "control" << 0x00000000 << ""; //QAccessible::NoRole - QTest::newRow("Dial") << "dial" << 0x00000031 << ""; //QAccessible::Dial - QTest::newRow("Dialog") << "dialog" << 0x00000012 << "Dialog"; //QAccessible::Dialog - QTest::newRow("Drawer") << "drawer" << 0x00000012 << ""; //QAccessible::Dialog - QTest::newRow("Frame") << "frame" << 0x00000013 << ""; //QAccessible::Border - QTest::newRow("GroupBox") << "groupbox" << 0x00000014 << "GroupBox"; //QAccessible::Grouping - QTest::newRow("ItemDelegate") << "itemdelegate" << 0x00000022 << "ItemDelegate"; //QAccessible::ListItem - QTest::newRow("Label") << "label" << 0x00000029 << "Label"; //QAccessible::StaticText - QTest::newRow("Menu") << "menu" << 0x0000000B << ""; //QAccessible::PopupMenu - QTest::newRow("MenuItem") << "menuitem" << 0x0000000C << "MenuItem"; //QAccessible::MenuItem - QTest::newRow("Page") << "page" << 0x00000025 << "Page"; //QAccessible::PageTab - QTest::newRow("PageIndicator") << "pageindicator" << 0x00000027 << ""; //QAccessible::Indicator - QTest::newRow("Pane") << "pane" << 0x00000010 << ""; //QAccessible::Pane - QTest::newRow("Popup") << "popup" << 0x00000012 << ""; //QAccessible::Dialog - QTest::newRow("ProgressBar") << "progressbar" << 0x00000030 << ""; //QAccessible::ProgressBar - QTest::newRow("RadioButton") << "radiobutton" << 0x0000002D << "RadioButton"; //QAccessible::RadioButton - QTest::newRow("RadioDelegate") << "radiodelegate" << 0x0000002D << "RadioDelegate"; //QAccessible::RadioButton - QTest::newRow("RangeSlider") << "rangeslider" << 0x00000033 << ""; //QAccessible::Slider - QTest::newRow("RoundButton") << "roundbutton" << 0x0000002B << "RoundButton"; //QAccessible::Button - QTest::newRow("ScrollBar") << "scrollbar" << 0x00000003 << ""; //QAccessible::ScrollBar - QTest::newRow("ScrollIndicator") << "scrollindicator" << 0x00000027 << ""; //QAccessible::Indicator - QTest::newRow("Slider") << "slider" << 0x00000033 << ""; //QAccessible::Slider - QTest::newRow("SpinBox") << "spinbox" << 0x00000034 << ""; //QAccessible::SpinBox - QTest::newRow("StackView") << "stackview" << 0x00000080 << ""; //QAccessible::LayeredPane - QTest::newRow("SwipeDelegate") << "swipedelegate" << 0x00000022 << "SwipeDelegate"; //QAccessible::ListItem - QTest::newRow("SwipeView") << "swipeview" << 0x0000003C << ""; //QAccessible::Pane - QTest::newRow("Switch") << "switch" << 0x0000002B << "Switch"; //QAccessible::Button - QTest::newRow("SwitchDelegate") << "switchdelegate" << 0x00000022 << "SwitchDelegate"; //QAccessible::ListItem - QTest::newRow("TabBar") << "tabbar" << 0x0000003C << ""; //QAccessible::PageTabList - QTest::newRow("TabButton") << "tabbutton" << 0x00000025 << "TabButton"; //QAccessible::PageTab - QTest::newRow("TextArea") << "textarea" << 0x0000002A << ""; //QAccessible::Accessible.EditableText - QTest::newRow("TextField") << "textfield" << 0x0000002A << ""; //QAccessible::Accessible.EditableText - QTest::newRow("ToolBar") << "toolbar" << 0x00000016 << ""; //QAccessible::ToolBar - QTest::newRow("ToolButton") << "toolbutton" << 0x0000002B << "ToolButton"; //QAccessible::Button - QTest::newRow("ToolTip") << "tooltip" << 0x0000000D << "ToolTip"; //QAccessible::ToolTip - QTest::newRow("Tumbler") << "tumbler" << 0x00000000 << ""; //QAccessible::NoRole (TODO) - - QTest::newRow("DayOfWeekRow") << "dayofweekrow" << 0x0 << "DayOfWeekRow"; //QAccessible::NoRole - QTest::newRow("MonthGrid") << "monthgrid" << 0x0 << "MonthGrid"; //QAccessible::NoRole - QTest::newRow("WeekNumberColumn") << "weeknumbercolumn" << 0x0 << "WeekNumberColumn"; //QAccessible::NoRole + QTest::newRow("AbstractButton") << "abstractbutton" << QAccessible::Button << "AbstractButton"; + QTest::newRow("BusyIndicator") << "busyindicator" << QAccessible::Indicator << ""; + QTest::newRow("Button") << "button" << QAccessible::Button << "Button"; + QTest::newRow("CheckBox") << "checkbox" << QAccessible::CheckBox << "CheckBox"; + QTest::newRow("CheckDelegate") << "checkdelegate" << QAccessible::CheckBox << "CheckDelegate"; + QTest::newRow("ComboBox") << "combobox" << QAccessible::ComboBox << "ComboBox"; + QTest::newRow("Container") << "container" << QAccessible::NoRole << ""; + QTest::newRow("Control") << "control" << QAccessible::NoRole << ""; + QTest::newRow("Dial") << "dial" << QAccessible::Dial << ""; + QTest::newRow("Dialog") << "dialog" << QAccessible::Dialog << "Dialog"; + QTest::newRow("Drawer") << "drawer" << QAccessible::Dialog << ""; + QTest::newRow("Frame") << "frame" << QAccessible::Border << ""; + QTest::newRow("GroupBox") << "groupbox" << QAccessible::Grouping << "GroupBox"; + QTest::newRow("ItemDelegate") << "itemdelegate" << QAccessible::ListItem << "ItemDelegate"; + QTest::newRow("Label") << "label" << QAccessible::StaticText << "Label"; + QTest::newRow("Menu") << "menu" << QAccessible::PopupMenu << ""; + QTest::newRow("MenuItem") << "menuitem" << QAccessible::MenuItem << "MenuItem"; + QTest::newRow("Page") << "page" << QAccessible::PageTab << "Page"; + QTest::newRow("PageIndicator") << "pageindicator" << QAccessible::Indicator << ""; + QTest::newRow("Pane") << "pane" << QAccessible::Pane << ""; + QTest::newRow("Popup") << "popup" << QAccessible::Dialog << ""; + QTest::newRow("ProgressBar") << "progressbar" << QAccessible::ProgressBar << ""; + QTest::newRow("RadioButton") << "radiobutton" << QAccessible::RadioButton << "RadioButton"; + QTest::newRow("RadioDelegate") << "radiodelegate" << QAccessible::RadioButton << "RadioDelegate"; + QTest::newRow("RangeSlider") << "rangeslider" << QAccessible::Slider << ""; + QTest::newRow("RoundButton") << "roundbutton" << QAccessible::Button << "RoundButton"; + QTest::newRow("ScrollBar") << "scrollbar" << QAccessible::ScrollBar << ""; + QTest::newRow("ScrollIndicator") << "scrollindicator" << QAccessible::Indicator << ""; + QTest::newRow("Slider") << "slider" << QAccessible::Slider << ""; + QTest::newRow("SpinBox") << "spinbox" << QAccessible::SpinBox << ""; + QTest::newRow("StackView") << "stackview" << QAccessible::LayeredPane << ""; + QTest::newRow("SwipeDelegate") << "swipedelegate" << QAccessible::ListItem << "SwipeDelegate"; + QTest::newRow("SwipeView") << "swipeview" << QAccessible::PageTabList << ""; + QTest::newRow("Switch") << "switch" << QAccessible::Button << "Switch"; + QTest::newRow("SwitchDelegate") << "switchdelegate" << QAccessible::ListItem << "SwitchDelegate"; + QTest::newRow("TabBar") << "tabbar" << QAccessible::PageTabList << ""; + QTest::newRow("TabButton") << "tabbutton" << QAccessible::PageTab << "TabButton"; + QTest::newRow("TextArea") << "textarea" << QAccessible::EditableText << ""; + QTest::newRow("TextField") << "textfield" << QAccessible::EditableText << ""; + QTest::newRow("ToolBar") << "toolbar" << QAccessible::ToolBar << ""; + QTest::newRow("ToolButton") << "toolbutton" << QAccessible::Button << "ToolButton"; + QTest::newRow("ToolTip") << "tooltip" << QAccessible::ToolTip << "ToolTip"; + QTest::newRow("Tumbler") << "tumbler" << QAccessible::NoRole << ""; // TODO + + QTest::newRow("DayOfWeekRow") << "dayofweekrow" << QAccessible::NoRole << "DayOfWeekRow"; + QTest::newRow("MonthGrid") << "monthgrid" << QAccessible::NoRole << "MonthGrid"; + QTest::newRow("WeekNumberColumn") << "weeknumbercolumn" << QAccessible::NoRole << "WeekNumberColumn"; } #if QT_CONFIG(accessibility) @@ -127,7 +127,7 @@ static QPlatformAccessibility *platformAccessibility() void tst_accessibility::a11y() { QFETCH(QString, name); - QFETCH(int, role); + QFETCH(QAccessible::Role, role); QFETCH(QString, text); QString fn = name; @@ -169,7 +169,7 @@ void tst_accessibility::a11y() } } QVERIFY(acc); - QCOMPARE(acc->role(), (QAccessible::Role)role); + QCOMPARE(acc->role(), role); QCOMPARE(acc->name(), text); #else Q_UNUSED(role) -- cgit v1.2.3 From 1427b243cb69768e7ce2e6ea3ad75619deac104b Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 16 May 2019 15:46:22 +0200 Subject: Don't unnecessarily transform keysequences into strings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise we cannot interpret them as the original key sequence anymore. When passing them on they are interpreted as the number key that represents the numeric value of the key sequence enum. Change-Id: Idd94ef95bc693cb6d51162dd1994adc953b52e25 Fixes: QTBUG-75572 Reviewed-by: Henning Gründl Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_action.qml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_action.qml b/tests/auto/controls/data/tst_action.qml index ef28c0e5..0e41b7f3 100644 --- a/tests/auto/controls/data/tst_action.qml +++ b/tests/auto/controls/data/tst_action.qml @@ -165,4 +165,33 @@ TestCase { keyClick(Qt.Key_A, Qt.ControlModifier) compare(spy.count, 1) } + + Component { + id: shortcutBinding + Item { + Action { + id: action + shortcut: StandardKey.Copy + } + + Shortcut { + id: indirectShortcut + sequence: action.shortcut + } + + Shortcut { + id: directShortcut + sequence: StandardKey.Copy + } + + property alias indirect: indirectShortcut; + property alias direct: directShortcut + } + } + + function test_shortcutBinding() { + var container = createTemporaryObject(shortcutBinding, testCase); + verify(container) + compare(container.indirect.nativeText, container.direct.nativeText); + } } -- cgit v1.2.3 From 761df2ced0081905b4238c66783bb276f504cf3d Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 13 Jun 2019 11:56:45 +0200 Subject: Accessibility: Switch should have checkbox as role Fixes: QTBUG-76356 Change-Id: I8f8e8331adbe741be2c893f2140d793d1b901434 Reviewed-by: Mitch Curtis --- tests/auto/accessibility/tst_accessibility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 0224f020..868b4413 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -100,7 +100,7 @@ void tst_accessibility::a11y_data() QTest::newRow("StackView") << "stackview" << QAccessible::LayeredPane << ""; QTest::newRow("SwipeDelegate") << "swipedelegate" << QAccessible::ListItem << "SwipeDelegate"; QTest::newRow("SwipeView") << "swipeview" << QAccessible::PageTabList << ""; - QTest::newRow("Switch") << "switch" << QAccessible::Button << "Switch"; + QTest::newRow("Switch") << "switch" << QAccessible::CheckBox << "Switch"; QTest::newRow("SwitchDelegate") << "switchdelegate" << QAccessible::ListItem << "SwitchDelegate"; QTest::newRow("TabBar") << "tabbar" << QAccessible::PageTabList << ""; QTest::newRow("TabButton") << "tabbutton" << QAccessible::PageTab << "TabButton"; -- cgit v1.2.3 From bb88d84475f7c4bb69528da5096f4d2c91667a3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Wed, 22 May 2019 15:40:06 +0200 Subject: Add a test for having a ShaderEffect as a delegate Change-Id: If4f3dca99638015b479509e4aa73e0190b1182ac Task-number: QTBUG-67343 Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_combobox.qml | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 0d266e1a..f8f06679 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -96,6 +96,45 @@ TestCase { } } + Component { + id: comboBoxWithShaderEffect + ComboBox { + delegate: Rectangle { + Text { + id: txt + anchors.centerIn: parent + text: "item" + index + font.pixelSize: 20 + color: "red" + } + id: rect + objectName: "rect" + width: parent.width + height: txt.implicitHeight + gradient: Gradient { + GradientStop { color: "lightsteelblue"; position: 0.0 } + GradientStop { color: "blue"; position: 1.0 } + } + layer.enabled: true + layer.effect: ShaderEffect { + objectName: "ShaderFX" + width: rect.width + height: rect.height + fragmentShader: " + uniform lowp sampler2D source; // this item + uniform lowp float qt_Opacity; // inherited opacity of this item + varying highp vec2 qt_TexCoord0; + void main() { + lowp vec4 p = texture2D(source, qt_TexCoord0); + lowp float g = dot(p.xyz, vec3(0.344, 0.5, 0.156)); + gl_FragColor = vec4(g, g, g, p.a) * qt_Opacity; + }" + + } + } + } + } + function init() { // QTBUG-61225: Move the mouse away to avoid QQuickWindowPrivate::flushFrameSynchronousEvents() // delivering interfering hover events based on the last mouse position from earlier tests. For @@ -1731,4 +1770,23 @@ TestCase { closedSpy.wait() compare(closedSpy.count, 1) } + + function test_comboBoxWithShaderEffect() { + var control = createTemporaryObject(comboBoxWithShaderEffect, testCase, {model: 9}) + verify(control) + waitForRendering(control) + control.forceActiveFocus() + var openedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "opened"}) + verify(openedSpy.valid) + + var closedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "closed"}) + verify(closedSpy.valid) + + control.popup.open() + openedSpy.wait() + compare(openedSpy.count, 1) + control.popup.close() + closedSpy.wait() + compare(closedSpy.count, 1) + } } -- cgit v1.2.3