From 7ded94bf0eb2b78f37bb9f84a0cc36e4ec520023 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 10 Jun 2019 14:03:12 +0200 Subject: SplitView: fix preferredHeight not being restored in restoreState() Change-Id: Icc236494f5df382d6bc49092d23a460822c835a1 Reviewed-by: Richard Moe Gustavsen --- tests/auto/controls/data/tst_splitview.qml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_splitview.qml b/tests/auto/controls/data/tst_splitview.qml index 55592eee..a03c09a0 100644 --- a/tests/auto/controls/data/tst_splitview.qml +++ b/tests/auto/controls/data/tst_splitview.qml @@ -1851,13 +1851,21 @@ TestCase { } } - function test_saveAndRestoreState() { - var control = createTemporaryObject(threeSizedItemsComponent, testCase) + function test_saveAndRestoreState_data() { + return [ + { tag: "Horizontal", orientation: Qt.Horizontal, propertyName: "preferredWidth", propertyValue: 123 }, + { tag: "Vertical", orientation: Qt.Vertical, propertyName: "preferredHeight", propertyValue: 234 } + ] + } + + function test_saveAndRestoreState(data) { + var control = createTemporaryObject(threeSizedItemsComponent, testCase, { orientation: data.orientation }) verify(control) + compare(control.orientation, data.orientation) var lastItem = control.itemAt(2) verify(lastItem) - lastItem.SplitView.preferredWidth = 123 + lastItem.SplitView[data.propertyName] = data.propertyValue // Save the state. var settings = createTemporaryObject(settingsComponent, testCase) @@ -1868,14 +1876,14 @@ TestCase { control = createTemporaryObject(threeSizedItemsComponent, testCase) lastItem = control.itemAt(2) verify(lastItem) - compare(lastItem.SplitView.preferredWidth, -1) + compare(lastItem.SplitView[data.propertyName], -1) settings = createTemporaryObject(settingsComponent, testCase) verify(settings) // Restore the state. control.restoreState(settings.value("splitView")) - compare(lastItem.SplitView.preferredWidth, 123) + compare(lastItem.SplitView[data.propertyName], data.propertyValue) } function test_changePreferredSizeDuringLayout() { -- cgit v1.2.3 From b00d649f109b080b7068c4a7a2a7731d7fb51ea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Thu, 13 Jun 2019 11:49:12 +0200 Subject: Simplify test a bit and make it less error-prone (adding type-safety) Change-Id: I1e8a6fec5af58ec7e94aaf20849ac3f48affb15f Reviewed-by: Mitch Curtis --- 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..87674a6b 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