aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@gmail.com>2012-09-07 11:06:59 +0200
committerQt by Nokia <qt-info@nokia.com>2012-09-07 11:22:55 +0200
commit86c13139749851037fc2a401976b9923b0df467a (patch)
tree2dbb1130e5c224adb64c34fc76dd2b5d7055fdca /tests
parenta3ca899129cff374386fdc7b702548b01c820bbe (diff)
Wrap tst_qqmllocale::timeZoneUpdated() within Q_OS_UNIX to remove QSKIP
Change-Id: I9cb0da7dbca6401069f572aef15d5375aadce30d Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Caroline Chao <caroline.chao@nokia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmllocale/tst_qqmllocale.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
index f9ced254da..e9d7154dcc 100644
--- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
+++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp
@@ -83,7 +83,9 @@ private slots:
void dateTimeFormat();
void timeFormat_data();
void timeFormat();
+#if defined(Q_OS_UNIX)
void timeZoneUpdated();
+#endif
void dateToLocaleString_data();
void dateToLocaleString();
@@ -1218,16 +1220,6 @@ void tst_qqmllocale::stringLocaleCompare()
QCOMPARE(obj->property("comparison").toInt(), QString::localeAwareCompare(string1, string2));
}
-static void setTimeZone(const QByteArray &tz)
-{
- qputenv("TZ", tz);
-#if defined(Q_OS_WIN32)
- ::_tzset();
-#elif defined(Q_OS_UNIX)
- ::tzset();
-#endif
-}
-
class DateFormatter : public QObject
{
Q_OBJECT
@@ -1244,17 +1236,25 @@ QString DateFormatter::getLocalizedForm(const QString &isoTimestamp)
return locale.toString(input);
}
-void tst_qqmllocale::timeZoneUpdated()
+#if defined(Q_OS_UNIX)
+// Currently disabled on Windows as adjusting the timezone
+// requires additional privileges that aren't normally
+// enabled for a process. This can be achieved by calling
+// AdjustTokenPrivileges() and then SetTimeZoneInformation(),
+// which will require linking to a different library to access that API.
+static void setTimeZone(const QByteArray &tz)
{
-#if !defined(Q_OS_UNIX)
- // Currently disabled on Windows as adjusting the timezone
- // requires additional privileges that aren't normally
- // enabled for a process. This can be achieved by calling
- // AdjustTokenPrivileges() and then SetTimeZoneInformation(),
- // which will require linking to a different library to access that API.
- QSKIP("Timezone manipulation not available for this platform");
-#endif
+ qputenv("TZ", tz);
+ ::tzset();
+// following left for future reference, see comment above
+// #if defined(Q_OS_WIN32)
+// ::_tzset();
+// #endif
+}
+
+void tst_qqmllocale::timeZoneUpdated()
+{
QByteArray original(qgetenv("TZ"));
// Set the timezone to Brisbane time
@@ -1281,6 +1281,7 @@ void tst_qqmllocale::timeZoneUpdated()
QCOMPARE(obj->property("success").toBool(), true);
}
+#endif
QTEST_MAIN(tst_qqmllocale)