summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-12-15 11:21:15 +0100
committerLiang Qi <liang.qi@qt.io>2017-12-15 11:21:15 +0100
commit3e7b3aae9c736ec62a727f218a73f86886e2a367 (patch)
treed06037b68eb1f69619957ab1883ddcdb56790f65 /tests
parentb9c95d63efde5d0ee9d332074285d5a4800391b5 (diff)
parent15c909f4170450cdbe01218a0d7cbea55b70fae5 (diff)
downloadqtquickcontrols-3e7b3aae9c736ec62a727f218a73f86886e2a367.tar.gz
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: .qmake.conf Change-Id: If27d9c3cbc17765c4180651189c4b8d19b8409da
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_calendar.qml29
-rw-r--r--tests/auto/controls/data/tst_rangeddate.qml5
-rw-r--r--tests/auto/controls/data/tst_scrollview.qml84
3 files changed, 110 insertions, 8 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_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()
+ }
}
}