@@ -21,6 +21,7 @@ import MeeGo.QOfono 0.2
2121import QMenuModel 0.1
2222import Ubuntu.Components 1.3
2323import Ubuntu.SystemSettings.SecurityPrivacy 1.0
24+import Ubuntu.SystemSettings.TimeDate 1.0
2425import Unity.Test 0.1 as UT
2526import Wizard 0.1
2627import "../../../qml/Wizard"
@@ -68,6 +69,11 @@ Item {
6869 signalName: "activated"
6970 }
7071
72+ SignalSpy {
73+ id: timezoneSpy
74+ signalName: "timeZoneChangedCalled"
75+ }
76+
7177 function setup() {
7278 AccountsService.hereEnabled = false;
7379 AccountsService.hereLicensePath = Qt.resolvedUrl("licenses");
@@ -81,6 +87,7 @@ Item {
8187 setSecuritySpy.clear();
8288 activateLocationSpy.clear();
8389 activateGPSSpy.clear();
90+ timezoneSpy.clear();
8491
8592 ActionData.data = {
8693 "location-detection-enabled": {
@@ -193,7 +200,7 @@ Item {
193200 var tzList = findChild(page, "tzList");
194201 verify(tzList);
195202 waitForRendering(tzList);
196− tzList.currentIndex = 0; // FIXME make it more generic
203+ tzList.currentIndex = 0;
197204 page.selectedTimeZone = "Pacific/Honolulu";
198205 tap(findChild(page, "forwardButton"));
199206
@@ -451,5 +458,30 @@ Item {
451458 tryCompare(activateLocationSpy, "count", 1);
452459 tryCompare(activateGPSSpy, "count", 1);
453460 }
461+
462+ function test_timezonePage() {
463+ var page = goToPage("tzPage");
464+ verify(page);
465+ timezoneSpy.target = page.tdModule;
466+
467+ var tzFilter = findChild(page, "tzFilter");
468+ verify(tzFilter);
469+ tap(tzFilter);
470+ typeString("London");
471+
472+ var tzList = findChild(page, "tzList");
473+ verify(tzList);
474+
475+ // test filtering works and returns some results
476+ tryCompareFunction(function() { return tzList.count > 0; }, true);
477+
478+ // just tap the first one
479+ tap(findChild(page, "tz0"));
480+
481+ // go next and verify the (mock) signal got fired
482+ tap(findChild(page, "forwardButton"));
483+ tryCompare(timezoneSpy, "count", 1);
484+ tryCompare(page.tdModule, "timeZone", timezoneSpy.signalArguments[0][0]);
485+ }
454486 }
455487}