aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/calendar/data
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-23 09:27:47 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2016-02-23 11:20:52 +0000
commit8778db4d8ca3727370137ad8578a5ef5461e0e71 (patch)
treebe6ac26b0d0c776750e9756a73e149fd2c22ec4a /tests/auto/calendar/data
parentfd33c3991418c38075ac39291807d223cc525877 (diff)
Extend tst_monthgrid
Change-Id: I8ec0828319e91df42c0bd9540953df7d431ef476 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/auto/calendar/data')
-rw-r--r--tests/auto/calendar/data/tst_monthgrid.qml80
1 files changed, 55 insertions, 25 deletions
diff --git a/tests/auto/calendar/data/tst_monthgrid.qml b/tests/auto/calendar/data/tst_monthgrid.qml
index d07b77db..6c60f92f 100644
--- a/tests/auto/calendar/data/tst_monthgrid.qml
+++ b/tests/auto/calendar/data/tst_monthgrid.qml
@@ -51,12 +51,26 @@ TestCase {
name: "MonthGrid"
Component {
- id: component
+ id: defaultGrid
MonthGrid { }
}
+ Component {
+ id: delegateGrid
+ MonthGrid {
+ delegate: Item {
+ readonly property date date: model.date
+ readonly property int day: model.day
+ readonly property bool today: model.today
+ readonly property int weekNumber: model.weekNumber
+ readonly property int month: model.month
+ readonly property int year: model.year
+ }
+ }
+ }
+
function test_locale() {
- var control = component.createObject(testCase, {month: 0, year: 2013})
+ var control = delegateGrid.createObject(testCase, {month: 0, year: 2013})
compare(control.contentItem.children.length, 6 * 7 + 1)
@@ -68,37 +82,53 @@ TestCase {
control.locale = Qt.locale("en_GB")
compare(control.locale.name, "en_GB")
- // M T W T F S S
- var en_GB = [31, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 1, 2, 3,
- 4, 5, 6, 7, 8, 9, 10]
-
- for (var i = 0; i < 42; ++i)
- compare(control.contentItem.children[i].text, en_GB[i].toString())
+ // M T W T F S S
+ var en_GB = ["2012-12-31", "2013-01-01", "2013-01-02", "2013-01-03", "2013-01-04", "2013-01-05", "2013-01-06",
+ "2013-01-07", "2013-01-08", "2013-01-09", "2013-01-10", "2013-01-11", "2013-01-12", "2013-01-13",
+ "2013-01-14", "2013-01-15", "2013-01-16", "2013-01-17", "2013-01-18", "2013-01-19", "2013-01-20",
+ "2013-01-21", "2013-01-22", "2013-01-23", "2013-01-24", "2013-01-25", "2013-01-26", "2013-01-27",
+ "2013-01-28", "2013-01-29", "2013-01-30", "2013-01-31", "2013-02-01", "2013-02-02", "2013-02-03",
+ "2013-02-04", "2013-02-05", "2013-02-06", "2013-02-07", "2013-02-08", "2013-02-09", "2013-02-10"]
+
+ for (var i = 0; i < 42; ++i) {
+ var cellDate = new Date(en_GB[i])
+ compare(control.contentItem.children[i].date.getFullYear(), cellDate.getFullYear())
+ compare(control.contentItem.children[i].date.getMonth(), cellDate.getMonth())
+ compare(control.contentItem.children[i].date.getDate(), cellDate.getDate())
+ compare(control.contentItem.children[i].day, cellDate.getDate())
+ compare(control.contentItem.children[i].today, cellDate === new Date())
+ compare(control.contentItem.children[i].month, cellDate.getMonth())
+ compare(control.contentItem.children[i].year, cellDate.getFullYear())
+ }
// en_US
control.locale = Qt.locale("en_US")
compare(control.locale.name, "en_US")
- // S M T W T F S
- var en_US = [30, 31, 1, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 1, 2,
- 3, 4, 5, 6, 7, 8, 9]
-
- for (var j = 0; j < 42; ++j)
- compare(control.contentItem.children[j].text, en_US[j].toString())
+ // S M T W T F S
+ var en_US = ["2012-12-30", "2012-12-31", "2013-01-01", "2013-01-02", "2013-01-03", "2013-01-04", "2013-01-05",
+ "2013-01-06", "2013-01-07", "2013-01-08", "2013-01-09", "2013-01-10", "2013-01-11", "2013-01-12",
+ "2013-01-13", "2013-01-14", "2013-01-15", "2013-01-16", "2013-01-17", "2013-01-18", "2013-01-19",
+ "2013-01-20", "2013-01-21", "2013-01-22", "2013-01-23", "2013-01-24", "2013-01-25", "2013-01-26",
+ "2013-01-27", "2013-01-28", "2013-01-29", "2013-01-30", "2013-01-31", "2013-02-01", "2013-02-02",
+ "2013-02-03", "2013-02-04", "2013-02-05", "2013-02-06", "2013-02-07", "2013-02-08", "2013-02-09"]
+
+ for (var j = 0; j < 42; ++j) {
+ cellDate = new Date(en_US[j])
+ compare(control.contentItem.children[j].date.getFullYear(), cellDate.getFullYear())
+ compare(control.contentItem.children[j].date.getMonth(), cellDate.getMonth())
+ compare(control.contentItem.children[j].date.getDate(), cellDate.getDate())
+ compare(control.contentItem.children[j].day, cellDate.getDate())
+ compare(control.contentItem.children[j].today, cellDate === new Date())
+ compare(control.contentItem.children[j].month, cellDate.getMonth())
+ compare(control.contentItem.children[j].year, cellDate.getFullYear())
+ }
control.destroy()
}
function test_range() {
- var control = component.createObject(testCase)
+ var control = defaultGrid.createObject(testCase)
control.month = 0
compare(control.month, 0)
@@ -132,7 +162,7 @@ TestCase {
}
function test_bce() {
- var control = component.createObject(testCase)
+ var control = defaultGrid.createObject(testCase)
compare(control.contentItem.children.length, 6 * 7 + 1)
@@ -178,7 +208,7 @@ TestCase {
}
function test_font() {
- var control = component.createObject(testCase)
+ var control = defaultGrid.createObject(testCase)
verify(control.contentItem.children[0])