on xenial help sign in
merged with trunk
31656eeNick Dedekind
CODING+2−2
@@ -1,7 +1,7 @@
1Building Unity 8
1Building Unity 8
2================
2================
3
3
4−Only Ubuntu 13.10 (saucy) is supported as a developement environment.
4+Only Ubuntu 14.04 (trusty) is supported as a developement environment.
5
5
6download source
6download source
7---------------
7---------------
@@ -68,7 +68,7 @@ Notes
68
68
69Running Unity 8 on devices
69Running Unity 8 on devices
70==========================
70==========================
71−- Ubuntu Touch builds are currently only available in 13.10 flavour
71+- Ubuntu Touch builds are currently only available in 14.04 flavour
72- supported hardware should match one of those listed here
72- supported hardware should match one of those listed here
73 https://wiki.ubuntu.com/Touch/Devices#Running_fine
73 https://wiki.ubuntu.com/Touch/Devices#Running_fine
74- follow the Ubuntu Touch install instructions for your chosen device
74- follow the Ubuntu Touch install instructions for your chosen device
data/unity8.overridenew file+1
@@ -0,0 +1 @@
1+kill timeout 30
debian/unity8-autopilot.install+1
@@ -1 +1,2 @@
1usr/lib/python*/*/unity*
1usr/lib/python*/*/unity*
2+data/unity8.override usr/share/upstart/sessions
plugins/Unity/Indicators/CMakeLists.txt−1
@@ -34,7 +34,6 @@ set(IndicatorsQML_SOURCES
34 unitymenumodelcache.cpp
34 unitymenumodelcache.cpp
35 unitymenumodelstack.cpp
35 unitymenumodelstack.cpp
36 visibleindicatorsmodel.cpp
36 visibleindicatorsmodel.cpp
37− timeformatter.cpp
38)
37)
39add_definitions(-DUNITYINDICATORS_LIBRARY)
38add_definitions(-DUNITYINDICATORS_LIBRARY)
40
39
plugins/Unity/Indicators/plugin.cpp−2
@@ -33,7 +33,6 @@
33#include "unitymenumodelcache.h"
33#include "unitymenumodelcache.h"
34#include "unitymenumodelstack.h"
34#include "unitymenumodelstack.h"
35#include "visibleindicatorsmodel.h"
35#include "visibleindicatorsmodel.h"
36−#include "timeformatter.h"
37
36
38static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
37static QObject* menuModelCacheSingleton(QQmlEngine* engine, QJSEngine* scriptEngine) {
39 Q_UNUSED(engine);
38 Q_UNUSED(engine);
@@ -52,7 +51,6 @@ void Indicators2Plugin::registerTypes(const char *uri)
52 qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState");
51 qmlRegisterType<RootActionState>(uri, 0, 1, "RootActionState");
53 qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
52 qmlRegisterType<ModelPrinter>(uri, 0, 1, "ModelPrinter");
54 qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
53 qmlRegisterType<VisibleIndicatorsModel>(uri, 0, 1, "VisibleIndicatorsModel");
55− qmlRegisterType<TimeFormatter>(uri, 0, 1, "TimeFormatter");
56
54
57 qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
55 qmlRegisterSingletonType<UnityMenuModelCache>(uri, 0, 1, "UnityMenuModelCache", menuModelCacheSingleton);
58
56
plugins/Unity/Indicators/qml/MenuItemFactory.qml+6−8
@@ -20,7 +20,7 @@
20import QtQuick 2.0
20import QtQuick 2.0
21import Ubuntu.Settings.Menus 0.1 as Menus
21import Ubuntu.Settings.Menus 0.1 as Menus
22import QMenuModel 0.1 as QMenuModel
22import QMenuModel 0.1 as QMenuModel
23−import Unity.Indicators 0.1 as Indicators
23+import Utils 0.1 as Utils
24import Ubuntu.Components.ListItems 0.1 as ListItems
24import Ubuntu.Components.ListItems 0.1 as ListItems
25
25
26Item {
26Item {
@@ -221,10 +221,9 @@ Item {
221 property int menuIndex: -1
221 property int menuIndex: -1
222 property var extendedData: menuData && menuData.ext || undefined
222 property var extendedData: menuData && menuData.ext || undefined
223 // TODO - bug #1260728
223 // TODO - bug #1260728
224− property var timeFormatter: Indicators.TimeFormatter {
224+ property var timeFormatter: Utils.GDateTimeFormatter {
225 time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
225 time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
226−// format: getExtendedProperty(extendedData, "xCanonicalTimeFormat", "")
226+ format: getExtendedProperty(extendedData, "xCanonicalTimeFormat", "")
227− format: "hh:mm - MMM dd"
228 }
227 }
229
228
230 text: menuData && menuData.label || ""
229 text: menuData && menuData.label || ""
@@ -259,10 +258,9 @@ Item {
259 property int menuIndex: -1
258 property int menuIndex: -1
260 property var extendedData: menuData && menuData.ext || undefined
259 property var extendedData: menuData && menuData.ext || undefined
261 // TODO - bug #1260728
260 // TODO - bug #1260728
262− property var timeFormatter: Indicators.TimeFormatter {
261+ property var timeFormatter: Utils.GDateTimeFormatter {
263 time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
262 time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
264−// format: getExtendedProperty(extendedData, "xCanonicalTimeFormat", "")
263+ format: getExtendedProperty(extendedData, "xCanonicalTimeFormat", "")
265− format: "hh:mm - MMM dd"
266 }
264 }
267
265
268 text: menuData && menuData.label || ""
266 text: menuData && menuData.label || ""
@@ -376,7 +374,7 @@ Item {
376 property var extendedData: menuData && menuData.ext || undefined
374 property var extendedData: menuData && menuData.ext || undefined
377
375
378 text: menuData && menuData.label || ""
376 text: menuData && menuData.label || ""
379− icon: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_app.svg")
377+ iconSource: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_app.svg")
380 count: menuData && menuData.actionState.length > 0 ? menuData.actionState[0] : "0"
378 count: menuData && menuData.actionState.length > 0 ? menuData.actionState[0] : "0"
381 enabled: menuData && menuData.sensitive || false
379 enabled: menuData && menuData.sensitive || false
382 removable: true
380 removable: true
plugins/Unity/Indicators/qml/MessageMenuItemFactory.qml+2−2
@@ -22,7 +22,7 @@ import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23import Ubuntu.Settings.Menus 0.1 as Menus
23import Ubuntu.Settings.Menus 0.1 as Menus
24import QMenuModel 0.1 as QMenuModel
24import QMenuModel 0.1 as QMenuModel
25−import Unity.Indicators 0.1 as Indicators
25+import Utils 0.1 as Utils
26
26
27Item {
27Item {
28 id: messageFactoryItem
28 id: messageFactoryItem
@@ -38,7 +38,7 @@ Item {
38 property var actionsDescription: getExtendedProperty(extendedData, "xCanonicalMessageActions", undefined)
38 property var actionsDescription: getExtendedProperty(extendedData, "xCanonicalMessageActions", undefined)
39
39
40 // TODO - bug #1260728
40 // TODO - bug #1260728
41− property var timeFormatter: Indicators.TimeFormatter {
41+ property var timeFormatter: Utils.TimeFormatter {
42 time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
42 time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
43 format: "hh:mm - MMM dd"
43 format: "hh:mm - MMM dd"
44 }
44 }
plugins/Utils/CMakeLists.txt+1
@@ -16,6 +16,7 @@ set(QMLPLUGIN_SRC
16 mediaartcache.cpp
16 mediaartcache.cpp
17 qlimitproxymodelqml.cpp
17 qlimitproxymodelqml.cpp
18 qsortfilterproxymodelqml.cpp
18 qsortfilterproxymodelqml.cpp
19+ timeformatter.cpp
19 unitymenumodelpaths.cpp
20 unitymenumodelpaths.cpp
20 plugin.cpp
21 plugin.cpp
21 )
22 )
plugins/Utils/plugin.cpp+3
@@ -30,6 +30,7 @@
30#include "bottombarvisibilitycommunicatorshell.h"
30#include "bottombarvisibilitycommunicatorshell.h"
31#include "qlimitproxymodelqml.h"
31#include "qlimitproxymodelqml.h"
32#include "qsortfilterproxymodelqml.h"
32#include "qsortfilterproxymodelqml.h"
33+#include "timeformatter.h"
33#include "unitymenumodelpaths.h"
34#include "unitymenumodelpaths.h"
34
35
35static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
36static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator";
@@ -42,6 +43,8 @@ void UtilsPlugin::registerTypes(const char *uri)
42 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
43 qmlRegisterType<QLimitProxyModelQML>(uri, 0, 1, "LimitProxyModel");
43 qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel");
44 qmlRegisterType<QSortFilterProxyModelQML>(uri, 0, 1, "SortFilterProxyModel");
44 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
45 qmlRegisterType<UnityMenuModelPaths>(uri, 0, 1, "UnityMenuModelPaths");
46+ qmlRegisterType<TimeFormatter>(uri, 0, 1, "TimeFormatter");
47+ qmlRegisterType<GDateTimeFormatter>(uri, 0, 1, "GDateTimeFormatter");
45 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
48 qmlRegisterUncreatableType<BottomBarVisibilityCommunicatorShell>(uri, 0, 1, "BottomBarVisibilityCommunicatorShell", "Can't create BottomBarVisibilityCommunicatorShell");
46}
49}
47
50
plugins/Unity/Indicators/timeformatter.cpp → plugins/Utils/timeformatter.cpprenamed+30−1
@@ -167,6 +167,35 @@ void TimeFormatter::setTime(qint64 time)
167
167
168void TimeFormatter::update()
168void TimeFormatter::update()
169{
169{
170− priv->timeString = QDateTime::fromMSecsSinceEpoch(priv->time / 1000).toString(priv->format);
170+ priv->timeString = formatTime();
171 Q_EMIT timeStringChanged(priv->timeString);
171 Q_EMIT timeStringChanged(priv->timeString);
172}
172}
173+
174+QString TimeFormatter::formatTime() const
175+{
176+ return QDateTime::fromMSecsSinceEpoch(time() / 1000).toString(format());
177+}
178+
179+GDateTimeFormatter::GDateTimeFormatter(QObject* parent)
180+: TimeFormatter(parent)
181+{
182+}
183+
184+QString GDateTimeFormatter::formatTime() const
185+{
186+ gchar* time_string;
187+ GDateTime* datetime;
188+ QByteArray formatBytes = format().toUtf8();
189+
190+ datetime = g_date_time_new_from_unix_local(time());
191+ if (!datetime) {
192+ return "";
193+ }
194+
195+ time_string = g_date_time_format(datetime, formatBytes.constData());
196+ QString formattedTime(QString::fromUtf8(time_string));
197+
198+ g_free(time_string);
199+ g_date_time_unref(datetime);
200+ return formattedTime;
201+}
plugins/Unity/Indicators/timeformatter.h → plugins/Utils/timeformatter.hrenamed+15−3
@@ -19,10 +19,10 @@
19#ifndef TIME_FORMATTER_H
19#ifndef TIME_FORMATTER_H
20#define TIME_FORMATTER_H
20#define TIME_FORMATTER_H
21
21
22−#include "unityindicatorsglobal.h"
23#include <QObject>
22#include <QObject>
24
23
24+// TODO - bug #1260728
25−class UNITYINDICATORS_EXPORT TimeFormatter : public QObject
25+class TimeFormatter : public QObject
26{
26{
27 Q_OBJECT
27 Q_OBJECT
28 Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
28 Q_PROPERTY(QString format READ format WRITE setFormat NOTIFY formatChanged)
@@ -31,7 +31,7 @@ class UNITYINDICATORS_EXPORT TimeFormatter : public QObject
31
31
32public:
32public:
33 TimeFormatter(QObject *parent = 0);
33 TimeFormatter(QObject *parent = 0);
34− ~TimeFormatter();
34+ virtual ~TimeFormatter();
35
35
36 QString format() const;
36 QString format() const;
37 QString timeString() const;
37 QString timeString() const;
@@ -47,8 +47,20 @@ Q_SIGNALS:
47 void timeStringChanged(const QString &timeString);
47 void timeStringChanged(const QString &timeString);
48 void timeChanged(qint64 time);
48 void timeChanged(qint64 time);
49
49
50+protected:
51+ virtual QString formatTime() const;
52+
50private:
53private:
51 struct TimeFormatterPrivate *priv;
54 struct TimeFormatterPrivate *priv;
52};
55};
53
56
57+class GDateTimeFormatter : public TimeFormatter
58+{
59+public:
60+ GDateTimeFormatter(QObject *parent = 0);
61+
62+protected:
63+ virtual QString formatTime() const;
64+};
65+
54#endif
66#endif
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+7−6
@@ -21,6 +21,7 @@
21
21
22from __future__ import absolute_import
22from __future__ import absolute_import
23
23
24+from unity8.process_helpers import unlock_unity
24from unity8.shell import disable_qml_mocking
25from unity8.shell import disable_qml_mocking
25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
26
27
@@ -78,8 +79,8 @@ class ApplicationLifecycleTests(UnityTestCase):
78 @disable_qml_mocking
79 @disable_qml_mocking
79 def test_can_launch_application(self):
80 def test_can_launch_application(self):
80 """Must be able to launch an application."""
81 """Must be able to launch an application."""
81− self.launch_unity()
82+ unity_proxy = self.launch_unity()
82− self.main_window.get_greeter().swipe()
83+ unlock_unity(unity_proxy)
83
84
84 app = self._launch_app("messaging-app")
85 app = self._launch_app("messaging-app")
85
86
@@ -92,8 +93,8 @@ class ApplicationLifecycleTests(UnityTestCase):
92 @disable_qml_mocking
93 @disable_qml_mocking
93 def test_can_launch_multiple_applications(self):
94 def test_can_launch_multiple_applications(self):
94 """A second application launched must be focused."""
95 """A second application launched must be focused."""
95− self.launch_unity()
96+ unity_proxy = self.launch_unity()
96− self.main_window.get_greeter().swipe()
97+ unlock_unity(unity_proxy)
97
98
98 self._launch_app("messaging-app")
99 self._launch_app("messaging-app")
99 self.assertThat(
100 self.assertThat(
@@ -113,8 +114,8 @@ class ApplicationLifecycleTests(UnityTestCase):
113 brought back to the focused state.
114 brought back to the focused state.
114
115
115 """
116 """
116− self.launch_unity()
117+ unity_proxy = self.launch_unity()
117− self.main_window.get_greeter().swipe()
118+ unlock_unity(unity_proxy)
118
119
119 self._launch_app("messaging-app")
120 self._launch_app("messaging-app")
120 self.assertThat(
121 self.assertThat(
tests/autopilot/unity8/shell/tests/test_lock_screen.py+9−8
@@ -20,6 +20,7 @@
20
20
21from __future__ import absolute_import
21from __future__ import absolute_import
22
22
23+from unity8.process_helpers import unlock_unity
23from unity8.shell import with_lightdm_mock
24from unity8.shell import with_lightdm_mock
24from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
25
26
@@ -40,11 +41,11 @@ class TestLockscreen(UnityTestCase):
40 @with_lightdm_mock("single-pin")
41 @with_lightdm_mock("single-pin")
41 def test_can_unlock_pin_screen(self):
42 def test_can_unlock_pin_screen(self):
42 """Must be able to unlock the PIN entry lock screen."""
43 """Must be able to unlock the PIN entry lock screen."""
43− self.launch_unity()
44+ unity_proxy = self.launch_unity()
44 greeter = self.main_window.get_greeter()
45 greeter = self.main_window.get_greeter()
45
46
46 if greeter.narrowMode:
47 if greeter.narrowMode:
47− greeter.swipe()
48+ unlock_unity(unity_proxy)
48 lockscreen = self._wait_for_lockscreen()
49 lockscreen = self._wait_for_lockscreen()
49 self._enter_pincode("1234")
50 self._enter_pincode("1234")
50 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
51 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
@@ -55,11 +56,11 @@ class TestLockscreen(UnityTestCase):
55 @with_lightdm_mock("single-passphrase")
56 @with_lightdm_mock("single-passphrase")
56 def test_can_unlock_passphrase_screen(self):
57 def test_can_unlock_passphrase_screen(self):
57 """Must be able to unlock the passphrase entry screen."""
58 """Must be able to unlock the passphrase entry screen."""
58− self.launch_unity()
59+ unity_proxy = self.launch_unity()
59 greeter = self.main_window.get_greeter()
60 greeter = self.main_window.get_greeter()
60
61
61 if greeter.narrowMode:
62 if greeter.narrowMode:
62− greeter.swipe()
63+ unlock_unity(unity_proxy)
63 lockscreen = self._wait_for_lockscreen()
64 lockscreen = self._wait_for_lockscreen()
64 self._enter_pin_passphrase("password")
65 self._enter_pin_passphrase("password")
65 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
66 self.assertThat(lockscreen.shown, Eventually(Equals(False)))
@@ -70,11 +71,11 @@ class TestLockscreen(UnityTestCase):
70 @with_lightdm_mock("single-pin")
71 @with_lightdm_mock("single-pin")
71 def test_pin_screen_wrong_code(self):
72 def test_pin_screen_wrong_code(self):
72 """Entering the wrong pin code must not dismiss the lock screen."""
73 """Entering the wrong pin code must not dismiss the lock screen."""
73− self.launch_unity()
74+ unity_proxy = self.launch_unity()
74 greeter = self.main_window.get_greeter()
75 greeter = self.main_window.get_greeter()
75
76
76 if greeter.narrowMode:
77 if greeter.narrowMode:
77− greeter.swipe()
78+ unlock_unity(unity_proxy)
78 lockscreen = self._wait_for_lockscreen()
79 lockscreen = self._wait_for_lockscreen()
79 self._enter_pincode("4321")
80 self._enter_pincode("4321")
80 pinentryField = self.main_window.get_pinentryField()
81 pinentryField = self.main_window.get_pinentryField()
@@ -89,11 +90,11 @@ class TestLockscreen(UnityTestCase):
89 @with_lightdm_mock("single-passphrase")
90 @with_lightdm_mock("single-passphrase")
90 def test_passphrase_screen_wrong_password(self):
91 def test_passphrase_screen_wrong_password(self):
91 """Entering the wrong password must not dismiss the lock screen."""
92 """Entering the wrong password must not dismiss the lock screen."""
92− self.launch_unity()
93+ unity_proxy = self.launch_unity()
93 greeter = self.main_window.get_greeter()
94 greeter = self.main_window.get_greeter()
94
95
95 if greeter.narrowMode:
96 if greeter.narrowMode:
96− greeter.swipe()
97+ unlock_unity(unity_proxy)
97 lockscreen = self._wait_for_lockscreen()
98 lockscreen = self._wait_for_lockscreen()
98 self._enter_pin_passphrase("foobar")
99 self._enter_pin_passphrase("foobar")
99 pinentryField = self.main_window.get_pinentryField()
100 pinentryField = self.main_window.get_pinentryField()
tests/mocks/LightDM/demo/CMakeLists.txt−1
@@ -1,4 +1,3 @@
1−include(FindPkgConfig)
2pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
1pkg_check_modules(LIBUSERMETRICSOUTPUT REQUIRED libusermetricsoutput-1)
3
2
4set(LibLightDM_SOURCES
3set(LibLightDM_SOURCES
tests/mocks/Unity/Application/CMakeLists.txt−1
@@ -1,4 +1,3 @@
1−include(FindPkgConfig)
2pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application)
1pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application)
3
2
4set(FakeUnityApplicationQml_SOURCES
3set(FakeUnityApplicationQml_SOURCES
tests/mocks/Unity/Launcher/CMakeLists.txt−1
@@ -1,4 +1,3 @@
1−include(FindPkgConfig)
2pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
1pkg_check_modules(LAUNCHER_API REQUIRED unity-shell-launcher=3)
3
2
4add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
3add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
tests/plugins/AccountsService/CMakeLists.txt+6−1
@@ -1,6 +1,11 @@
1+if(DEFINED ENV{DEB_BUILD_MULTIARCH})
2+ set(QDBUSXML2CPP_EXECUTABLE "/usr/lib/$ENV{DEB_BUILD_MULTIARCH}/qt5/bin/qdbusxml2cpp")
3+else()
4+ FIND_PROGRAM(QDBUSXML2CPP_EXECUTABLE qdbusxml2cpp)
5+endif()
1macro(make_dbus_class NAME INTERFACE)
6macro(make_dbus_class NAME INTERFACE)
2 if(${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor.h)
7 if(${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor.h)
3− execute_process(COMMAND qdbusxml2cpp -c ${NAME}Adaptor -a ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor ${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml ${INTERFACE})
8+ execute_process(COMMAND ${QDBUSXML2CPP_EXECUTABLE} -c ${NAME}Adaptor -a ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor ${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml ${INTERFACE})
4 endif()
9 endif()
5endmacro(make_dbus_class)
10endmacro(make_dbus_class)
6
11
tests/plugins/Unity/Indicators/CMakeLists.txt−1
@@ -40,4 +40,3 @@ indicator_test(indicatorsmodeltest ADDITIONAL_LIBS IndicatorsQml)
40indicator_test(menucontentactivatortest ADDITIONAL_CPPS ${INDICATORS_DIR}/menucontentactivator.cpp)
40indicator_test(menucontentactivatortest ADDITIONAL_CPPS ${INDICATORS_DIR}/menucontentactivator.cpp)
41indicator_test(unitymenumodelstacktest ADDITIONAL_CPPS ${TEST_DIR}/mocks/QMenuModel/unitymenumodel.cpp ${INDICATORS_DIR}/unitymenumodelstack.cpp)
41indicator_test(unitymenumodelstacktest ADDITIONAL_CPPS ${TEST_DIR}/mocks/QMenuModel/unitymenumodel.cpp ${INDICATORS_DIR}/unitymenumodelstack.cpp)
42indicator_test(rootactionstatetest ADDITIONAL_LIBS IndicatorsQml)
42indicator_test(rootactionstatetest ADDITIONAL_LIBS IndicatorsQml)
43−indicator_test(timeformattertest ADDITIONAL_LIBS IndicatorsQml)
tests/plugins/Utils/CMakeLists.txt+1
@@ -24,4 +24,5 @@ endmacro(run_tests)
24run_tests(
24run_tests(
25 qlimitproxymodeltest
25 qlimitproxymodeltest
26 qsortfilterproxymodeltest
26 qsortfilterproxymodeltest
27+ timeformattertest
27 )
28 )
tests/plugins/Unity/Indicators/timeformattertest.cpp → tests/plugins/Utils/timeformattertest.cpprenamed+13
@@ -48,6 +48,19 @@ private Q_SLOTS:
48
48
49 QCOMPARE(formatter.timeString(), time.toString(format));
49 QCOMPARE(formatter.timeString(), time.toString(format));
50 }
50 }
51+
52+ void testFormatStrF()
53+ {
54+ const QString format = "%d-%m-%Y %I:%M%p";
55+
56+ QDateTime time = QDateTime::currentDateTime();
57+
58+ GDateTimeFormatter formatter;
59+ formatter.setTime(time.toMSecsSinceEpoch() / 1000); // strftime in seconds since epoc
60+ formatter.setFormat(format);
61+
62+ QCOMPARE(formatter.timeString(), time.toString("dd-MM-yyyy hh:mmAP"));
63+ }
51};
64};
52
65
53QTEST_GUILESS_MAIN(TimeFormatterTest)
66QTEST_GUILESS_MAIN(TimeFormatterTest)