on xenial help sign in
Fixed appointment colouration
commita24f43e956b9a7504d3b754f064143057db24fc5 authorNick Dedekind <nicholas.dedekind@gmail.com> dateMon 14 Apr 2014, 16:08 (13 years ago) parent9c61eb8
2 files changed+30−5
plugins/Unity/Indicators/qml/MenuItemFactory.qml+1−1 tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+29−4
plugins/Unity/Indicators/qml/MenuItemFactory.qml+1−1
@@ -273,7 +273,7 @@ Item {
273273 text: menuData && menuData.label || ""
274274 iconSource: menuData && menuData.icon || "image://theme/calendar"
275275 time: timeFormatter.timeString
276− eventColor: menu && menu.ext.hasOwnProperty("xCanonicalColor") ? menu.ext.xCanonicalColor : Qt.rgba(0.0, 0.0, 0.0, 0.0)
276+ eventColor: getExtendedProperty(extendedData, "xCanonicalColor", Qt.rgba(0.0, 0.0, 0.0, 0.0))
277277 enabled: menuData && menuData.sensitive || false
278278
279279 onMenuModelChanged: {
tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+29−4
@@ -19,6 +19,7 @@ import QtTest 1.0
1919import Unity.Test 0.1 as UT
2020import QMenuModel 0.1
2121import Unity.Indicators 0.1 as Indicators
22+import Utils 0.1 as Utils
2223
2324Item {
2425 id: testView
@@ -42,6 +43,10 @@ Item {
4243 }
4344 }
4445
46+ Utils.GDateTimeFormatter {
47+ id: timeFormatter
48+ }
49+
4550 UT.UnityTestCase {
4651 name: "MenuItemFactory"
4752
@@ -357,8 +362,10 @@ Item {
357362
358363 function test_create_alarmMenu_data() {
359364 return [
360− {label: "testLabel1", enabled: true, icon: "file:///testIcon1" },
361− {label: "testLabel2", enabled: false, icon: "file:///testIcon2" },
365+ {label: "testLabel1", enabled: true, icon: "file:///testIcon1", color: Qt.rgba(0, 0, 0, 0),
366+ time: new Date(2014, 04, 14).getTime()*1000, timeFormat: "%a %d %b %l:%M %p"},
367+ {label: "testLabel2", enabled: false, icon: "file:///testIcon2", color: Qt.rgba(1, 0, 0, 0),
368+ time: new Date(2015, 12, 31).getTime()*1000, timeFormat: "%A" },
362369 ];
363370 }
364371
@@ -367,6 +374,12 @@ Item {
367374 menuData.label = data.label;
368375 menuData.sensitive = data.enabled;
369376 menuData.icon = data.icon;
377+ menuData.ext = {
378+ 'xCanonicalTime': data.time,
379+ 'xCanonicalTimeFormat': data.timeFormat
380+ };
381+ timeFormatter.format = data.timeFormat;
382+ timeFormatter.time = data.time;
370383
371384 loader.data = menuData;
372385 loader.sourceComponent = factory.load(menuData);
@@ -375,13 +388,16 @@ Item {
375388
376389 compare(loader.item.text, data.label, "Label does not match data");
377390 compare(loader.item.iconSource, data.icon, "Icon does not match data");
391+ compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
378392 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
379393 }
380394
381395 function test_create_appointmentMenu_data() {
382396 return [
383− {label: "testLabel1", enabled: true, icon: "file:///testIcon1" },
384− {label: "testLabel2", enabled: false, icon: "file:///testIcon2" },
397+ {label: "testLabel1", enabled: true, icon: "file:///testIcon1", color: Qt.rgba(0, 0, 0, 0),
398+ time: new Date(2014, 04, 14).getTime()*1000, timeFormat: "%a %d %b %l:%M %p"},
399+ {label: "testLabel2", enabled: false, icon: "file:///testIcon2", color: Qt.rgba(1, 0, 0, 0),
400+ time: new Date(2015, 12, 31).getTime()*1000, timeFormat: "%A" },
385401 ];
386402 }
387403
@@ -390,6 +406,13 @@ Item {
390406 menuData.label = data.label;
391407 menuData.sensitive = data.enabled;
392408 menuData.icon = data.icon;
409+ menuData.ext = {
410+ 'xCanonicalColor': data.colour,
411+ 'xCanonicalTime': data.time,
412+ 'xCanonicalTimeFormat': data.timeFormat
413+ };
414+ timeFormatter.format = data.timeFormat;
415+ timeFormatter.time = data.time;
393416
394417 loader.data = menuData;
395418 loader.sourceComponent = factory.load(menuData);
@@ -398,6 +421,8 @@ Item {
398421
399422 compare(loader.item.text, data.label, "Label does not match data");
400423 compare(loader.item.iconSource, data.icon, "Icon does not match data");
424+ compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
425+ compare(loader.item.eventColor, data.color, "Colour does not match data");
401426 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
402427 }
403428