|
1 /* |
|
2 * Copyright (c) 2008, 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: test code |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <QtTest/QtTest> |
|
21 |
|
22 #ifdef Q_OS_SYMBIAN |
|
23 #include "t_hsclockwidget.h" |
|
24 #include "hsclocksettingsnotifier_symbian.h" |
|
25 |
|
26 #include <bacntf.h> // CEnvironmentChangeNotifier |
|
27 |
|
28 |
|
29 namespace |
|
30 { |
|
31 const char ANALOG[] = "analog"; |
|
32 const char DIGITAL[] = "digital"; |
|
33 const char TIME12[] = "TIME12"; |
|
34 const char TIME24[] = "TIME24"; |
|
35 } |
|
36 |
|
37 |
|
38 void TestClockWidget::testSettingOfClockAndTimeFormat() |
|
39 { |
|
40 HsClockSettingsNotifier clockSettingsNotifier; |
|
41 |
|
42 QVERIFY(clockSettingsNotifier.mDateTimeNotifier); |
|
43 QVERIFY(clockSettingsNotifier.mDateTimeNotifier->IsActive()); |
|
44 |
|
45 TLocale locale; |
|
46 |
|
47 // ANALOG, TIME12 |
|
48 locale.SetClockFormat(EClockAnalog); |
|
49 locale.SetTimeFormat(ETime12); |
|
50 locale.Set(); |
|
51 qApp->processEvents(); |
|
52 |
|
53 TClockFormat clockFormat = locale.ClockFormat(); |
|
54 TTimeFormat timeFormat = locale.TimeFormat(); |
|
55 |
|
56 QCOMPARE( clockSettingsNotifier.clockFormat(), QString(ANALOG)); |
|
57 QCOMPARE( clockSettingsNotifier.timeFormat(), QString(TIME12)); |
|
58 |
|
59 // ANALOG, TIME24 |
|
60 locale.SetClockFormat(EClockAnalog); |
|
61 locale.SetTimeFormat(ETime24); |
|
62 locale.Set(); |
|
63 qApp->processEvents(); |
|
64 |
|
65 clockFormat = locale.ClockFormat(); |
|
66 timeFormat = locale.TimeFormat(); |
|
67 |
|
68 QCOMPARE( clockSettingsNotifier.clockFormat(), QString(ANALOG)); |
|
69 QCOMPARE( clockSettingsNotifier.timeFormat(), QString(TIME24)); |
|
70 |
|
71 // DIGITAL, TIME24 |
|
72 locale.SetClockFormat(EClockDigital); |
|
73 locale.SetTimeFormat(ETime24); |
|
74 locale.Set(); |
|
75 qApp->processEvents(); |
|
76 |
|
77 clockFormat = locale.ClockFormat(); |
|
78 timeFormat = locale.TimeFormat(); |
|
79 |
|
80 QCOMPARE( clockSettingsNotifier.clockFormat(), QString(DIGITAL)); |
|
81 QCOMPARE( clockSettingsNotifier.timeFormat(), QString(TIME24)); |
|
82 |
|
83 // DIGITAL, TIME12 |
|
84 locale.SetClockFormat(EClockDigital); |
|
85 locale.SetTimeFormat(ETime12); |
|
86 locale.Set(); |
|
87 qApp->processEvents(); |
|
88 |
|
89 clockFormat = locale.ClockFormat(); |
|
90 timeFormat = locale.TimeFormat(); |
|
91 |
|
92 QCOMPARE( clockSettingsNotifier.clockFormat(), QString(DIGITAL)); |
|
93 QCOMPARE( clockSettingsNotifier.timeFormat(), QString(TIME12)); |
|
94 |
|
95 clockSettingsNotifier.createObserver(); |
|
96 QVERIFY(clockSettingsNotifier.mDateTimeNotifier); |
|
97 QVERIFY(clockSettingsNotifier.mDateTimeNotifier->IsActive()); |
|
98 } |
|
99 |
|
100 |
|
101 |
|
102 #endif |
|
103 |
|
104 // end of file |