90
|
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 |
|
98
|
56 |
QCOMPARE( clockSettingsNotifier.clockType(), QString(ANALOG));
|
90
|
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 |
|
98
|
68 |
QCOMPARE( clockSettingsNotifier.clockType(), QString(ANALOG));
|
90
|
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 |
|
98
|
80 |
QCOMPARE( clockSettingsNotifier.clockType(), QString(DIGITAL));
|
90
|
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 |
|
98
|
92 |
QCOMPARE( clockSettingsNotifier.clockType(), QString(DIGITAL));
|
90
|
93 |
QCOMPARE( clockSettingsNotifier.timeFormat(), QString(TIME12));
|
|
94 |
|
98
|
95 |
clockSettingsNotifier.createSystemChangeObserver();
|
90
|
96 |
QVERIFY(clockSettingsNotifier.mDateTimeNotifier);
|
|
97 |
QVERIFY(clockSettingsNotifier.mDateTimeNotifier->IsActive());
|
|
98 |
}
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
#endif
|
|
103 |
|
|
104 |
// end of file
|