summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-12-18 11:00:37 +0100
committerLiang Qi <liang.qi@qt.io>2017-12-18 11:00:37 +0100
commit3aeca5366600fa4f888865012bf6b9e2b5418181 (patch)
tree995abf937f0ef9f513538d62052d973663443bb7 /tests
parentd60ab44407c2bf399b3f5d77fe9cd21951629b19 (diff)
parent65976402344a2642d6d6dc5bfbf71b3b511f6d12 (diff)
downloadqtquickcontrols-3aeca5366600fa4f888865012bf6b9e2b5418181.tar.gz
Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: Ie66ca17fe8ea49b3637accb468e206657346f4ab
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_calendar.qml29
-rw-r--r--tests/auto/controls/data/tst_combobox.qml24
-rw-r--r--tests/auto/controls/data/tst_rangeddate.qml5
-rw-r--r--tests/auto/controls/data/tst_scrollview.qml84
-rw-r--r--tests/auto/controls/data/tst_slider.qml18
-rw-r--r--tests/auto/controls/data/tst_tableview.qml2
6 files changed, 130 insertions, 32 deletions
diff --git a/tests/auto/controls/data/tst_calendar.qml b/tests/auto/controls/data/tst_calendar.qml
index 814a361a..55283b02 100644
--- a/tests/auto/controls/data/tst_calendar.qml
+++ b/tests/auto/controls/data/tst_calendar.qml
@@ -129,7 +129,10 @@ Item {
compare(calendar.minimumDate, new Date(1, 0, 1));
compare(calendar.maximumDate, new Date(4000, 0, 1));
- compare(calendar.selectedDate, new Date(new Date().setHours(0, 0, 0, 0)));
+ var expectedDate = new Date();
+ compare(calendar.selectedDate.getFullYear(), expectedDate.getFullYear());
+ compare(calendar.selectedDate.getMonth(), expectedDate.getMonth());
+ compare(calendar.selectedDate.getDate(), expectedDate.getDate());
compare(calendar.frameVisible, true);
compare(calendar.dayOfWeekFormat, Locale.ShortFormat);
compare(calendar.locale, Qt.locale());
@@ -406,7 +409,9 @@ Item {
expectedDate.setDate(expectedDate.getDate() + cellIndex);
mousePress(calendar, toPixelsX(day), toPixelsY(week), Qt.LeftButton);
- compare(calendar.selectedDate, expectedDate);
+ compare(calendar.selectedDate.getFullYear(), expectedDate.getFullYear());
+ compare(calendar.selectedDate.getMonth(), expectedDate.getMonth());
+ compare(calendar.selectedDate.getDate(), expectedDate.getDate());
compare(calendar.__panel.pressedCellIndex, cellIndex);
compare(pressedSignalSpy.count, 1);
compare(releasedSignalSpy.count, 0);
@@ -434,7 +439,9 @@ Item {
// Ensure released event does not trigger date selection.
calendar.selectedDate = startDate;
mousePress(calendar, toPixelsX(1), toPixelsY(0), Qt.LeftButton);
- compare(calendar.selectedDate, new Date(2012, 11, 31));
+ compare(calendar.selectedDate.getFullYear(), 2012);
+ compare(calendar.selectedDate.getMonth(), 11);
+ compare(calendar.selectedDate.getDate(), 31);
compare(calendar.__panel.pressedCellIndex, 1);
compare(pressedSignalSpy.count, 1);
compare(releasedSignalSpy.count, 0);
@@ -445,7 +452,9 @@ Item {
clickedSignalSpy.clear();
mouseRelease(calendar, toPixelsX(1), toPixelsY(0), Qt.LeftButton);
- compare(calendar.selectedDate, new Date(2012, 11, 31));
+ compare(calendar.selectedDate.getFullYear(), 2012);
+ compare(calendar.selectedDate.getMonth(), 11);
+ compare(calendar.selectedDate.getDate(), 31);
compare(calendar.__panel.pressedCellIndex, -1);
compare(pressedSignalSpy.count, 0);
compare(releasedSignalSpy.count, 1);
@@ -534,7 +543,9 @@ Item {
calendar.locale = Qt.locale("en_GB");
calendar.selectedDate = new Date(2014, 11, 1);
mousePress(calendar, toPixelsX(0), toPixelsY(0), Qt.LeftButton);
- compare(calendar.selectedDate, new Date(2014, 10, 24));
+ compare(calendar.selectedDate.getFullYear(), 2014);
+ compare(calendar.selectedDate.getMonth(), 10);
+ compare(calendar.selectedDate.getDate(), 24);
mouseRelease(calendar, toPixelsX(0), toPixelsY(0), Qt.LeftButton);
}
@@ -585,7 +596,9 @@ Item {
function dragTo(cellX, cellY, expectedCellIndex, expectedDate) {
mouseMove(calendar, toPixelsX(cellX), toPixelsY(cellY));
- compare(calendar.selectedDate, expectedDate);
+ compare(calendar.selectedDate.getFullYear(), expectedDate.getFullYear());
+ compare(calendar.selectedDate.getMonth(), expectedDate.getMonth());
+ compare(calendar.selectedDate.getDate(), expectedDate.getDate());
compare(calendar.__panel.pressedCellIndex, expectedCellIndex);
compare(hoveredSignalSpy.count, 1);
compare(pressedSignalSpy.count, 1);
@@ -627,7 +640,9 @@ Item {
3 4 5 6 7 8 9 3 4 5 6 7 8 9 */
mousePress(calendar, toPixelsX(5), toPixelsY(0), Qt.LeftButton);
- compare(calendar.selectedDate, new Date(2014, 1, 1));
+ compare(calendar.selectedDate.getFullYear(), 2014);
+ compare(calendar.selectedDate.getMonth(), 1);
+ compare(calendar.selectedDate.getDate(), 1);
compare(calendar.__panel.pressedCellIndex, 5);
compare(pressedSignalSpy.count, 1);
compare(releasedSignalSpy.count, 0);
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index ce8b6c42..c380c63a 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -66,14 +66,6 @@ TestCase {
property var model
- Timer {
- id: timer
- running: true
- repeat: false
- interval: 500
- onTriggered: testCase.keyPress(Qt.Key_Escape)
- }
-
function init() {
model = Qt.createQmlObject("import QtQuick 2.2; ListModel {}", testCase, '')
model.append({ text: "Banana", color: "Yellow" })
@@ -505,20 +497,14 @@ TestCase {
var comboBox = Qt.createQmlObject('import QtQuick.Controls 1.2 ; ComboBox { model: 4 }', container, '');
comboBox.activeFocusOnPress = false
verify(!comboBox.activeFocus)
- if (Qt.platform.os === "osx") // on mac 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)
+ // two mouse clicks to open and close the popup menu
+ mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1)
mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1)
verify(!comboBox.activeFocus)
comboBox.activeFocusOnPress = true
- 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. 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)
- }
+ // 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_rangeddate.qml b/tests/auto/controls/data/tst_rangeddate.qml
index cad94eb4..a1874441 100644
--- a/tests/auto/controls/data/tst_rangeddate.qml
+++ b/tests/auto/controls/data/tst_rangeddate.qml
@@ -69,7 +69,10 @@ Item {
function test_defaultConstruction() {
// rangedDate.date should be the current date.
- compare(rangedDate.date.getTime(), new Date(Date.now()).setHours(0, 0, 0, 0));
+ var expectedDate = new Date();
+ compare(rangedDate.date.getFullYear(), expectedDate.getFullYear());
+ compare(rangedDate.date.getMonth(), expectedDate.getMonth());
+ compare(rangedDate.date.getDate(), expectedDate.getDate());
}
function test_minMax() {
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml
index 842fd6dc..42398115 100644
--- a/tests/auto/controls/data/tst_scrollview.qml
+++ b/tests/auto/controls/data/tst_scrollview.qml
@@ -139,6 +139,45 @@ TestCase {
}
}
+ Component {
+ id: tabNavigationComponent
+ ApplicationWindow {
+ property alias scrollView: view
+ property alias control1: text1
+ property alias control2: text2
+ property alias control3: button
+
+ width: 400
+ height: 300
+ visible: true
+ modality: Qt.WindowModal
+
+ ScrollView {
+ id: view
+ anchors { top: parent.top; left: parent.left; right: parent.right; bottom: button.top }
+ Column {
+ width: view.width
+ TextField {
+ id: text1
+ anchors { left: parent.left; right: parent.right }
+ height: 30
+ }
+ TextField {
+ id: text2
+ anchors { left: parent.left; right: parent.right }
+ height: 30
+ }
+ }
+ }
+
+ Button {
+ id: button
+ anchors.bottom: parent.bottom
+ text: "hi"
+ }
+ }
+ }
+
function test_dragFetchAppend() { // QTBUG-50795
var scrollView = dragFetchAppendComponent.createObject(container)
verify(scrollView !== null, "view created is null")
@@ -319,5 +358,50 @@ TestCase {
verify(!control.control3.activeFocus)
control.destroy()
}
+
+ function test_navigation_QTBUG_64596() {
+ if (Qt.styleHints.tabFocusBehavior != Qt.TabFocusAllControls)
+ skip("This function doesn't support NOT iterating all.")
+
+ var control = tabNavigationComponent.createObject(container)
+ verify(control)
+ waitForRendering(control.contentItem)
+
+ control.requestActivate()
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ // and backwards
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ control.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 9e2ba0f1..e95d26d9 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -136,8 +136,22 @@ Item {
slider.destroy()
}
+ Component {
+ id: fixedHandleSizeSlider
+
+ Slider {
+ style: SliderStyle {
+ handle: Rectangle {
+ color: "red"
+ implicitWidth: 15
+ implicitHeight: 15
+ }
+ }
+ }
+ }
+
function test_mouseWheel() {
- var slider = Qt.createQmlObject('import QtQuick.Controls 1.2; Slider {}', container, '');
+ var slider = createTemporaryObject(fixedHandleSizeSlider, container)
slider.forceActiveFocus()
slider.value = 0
slider.maximumValue = 300
@@ -182,8 +196,6 @@ Item {
slider.wheelEnabled = false
mouseWheel(slider, 5, 5, 4 * ratio, 0)
compare(slider.value, 0)
-
- slider.destroy()
}
function test_activeFocusOnPress(){
diff --git a/tests/auto/controls/data/tst_tableview.qml b/tests/auto/controls/data/tst_tableview.qml
index 8bd40ae3..fe50f241 100644
--- a/tests/auto/controls/data/tst_tableview.qml
+++ b/tests/auto/controls/data/tst_tableview.qml
@@ -971,8 +971,6 @@ TestCase {
table.getColumn(0).width = 20
compare(table.getColumn(0).width, 20)
table.resizeColumnsToContents()
- if (Qt.platform.pluginName === "offscreen")
- skip("", "QTBUG-62496")
compare(table.getColumn(0).width, 50)
table.destroy()
}