@@ -43,8 +43,7 @@ Rectangle {
43 var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate)
43 var dateString = Qt.formatDate(dateObj, Qt.DefaultLocaleLongDate)
44 var timeString = Qt.formatTime(dateObj)
44 var timeString = Qt.formatTime(dateObj)
46− clock.__timerInterval = 60000
46+ clock.currentDate = dateObj
47− clock.__date = dateObj
48 var dateLabel = findChild(clock, "dateLabel")
47 var dateLabel = findChild(clock, "dateLabel")
49 compare(dateLabel.text, dateString, "Not the expected date")
48 compare(dateLabel.text, dateString, "Not the expected date")
50 var timeLabel = findChild(clock, "timeLabel")
49 var timeLabel = findChild(clock, "timeLabel")
@@ -57,33 +56,20 @@ Rectangle {
57 var timeString = Qt.formatTime(dateObj)
56 var timeString = Qt.formatTime(dateObj)
59 clock.enabled = false
58 clock.enabled = false
60− compare(clock.__timerRunning, false, "Timer should not be running")
59+ var timeModel = findInvisibleChild(clock, "timeModel")
61+ compare(timeModel.menuObjectPath, "", "Clock shouldn't be connected to Indicators when not active.")
61− clock.__date = dateObj
63+ clock.currentDate = dateObj
62− clock.__timerInterval = 5
64+
63− wait(5) // spin event loop (only that would trigger the timer and reveal eventual bugs)
64 var dateLabel = findChild(clock, "dateLabel")
65 var dateLabel = findChild(clock, "dateLabel")
65 compare(dateLabel.text, dateString, "Not the expected date")
66 compare(dateLabel.text, dateString, "Not the expected date")
66 var timeLabel = findChild(clock, "timeLabel")
67 var timeLabel = findChild(clock, "timeLabel")
67 compare(timeLabel.text, timeString, "Not the expected time")
68 compare(timeLabel.text, timeString, "Not the expected time")
69 clock.enabled = true
70 clock.enabled = true
70− compare(clock.__timerRunning, true, "Timer should be running")
71− wait(0) // spin event loop to trigger the timer
72− verify(dateLabel.text !== dateString)
73− if (timeLabel.text.indexOf("11:13") != -1) wait(60000) // next test will fail at 11:13, wait 1 minute
74− verify(timeLabel.text !== timeString)
77− function test_timerRunning() {
72+ verify(timeModel.menuObjectPath != "", "Should be connected to Indicators.")
78− // tests for clock.enabled property are already in test_dateUpdate()
80− compare(clock.__timerRunning, false, "Timer should not be running")
82− compare(clock.__timerRunning, true, "Timer should be running")
83− clock.visible = false
84− compare(clock.__timerRunning, false, "Timer should not be running")
86− compare(clock.__timerRunning, true, "Timer should be running")