@@ -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 when: windowShown
@@ -358,8 +363,10 @@ Item {
358363
359364 function test_create_alarmMenu_data() {
360365 return [
361− {label: "testLabel1", enabled: true, icon: "file:///testIcon1" },
362− {label: "testLabel2", enabled: false, icon: "file:///testIcon2" },
366+ {label: "testLabel1", enabled: true, icon: "file:///testIcon1", color: Qt.rgba(0, 0, 0, 0),
367+ time: new Date(2014, 04, 14).getTime()*1000, timeFormat: "%a %d %b %l:%M %p"},
368+ {label: "testLabel2", enabled: false, icon: "file:///testIcon2", color: Qt.rgba(1, 0, 0, 0),
369+ time: new Date(2015, 12, 31).getTime()*1000, timeFormat: "%A" },
363370 ];
364371 }
365372
@@ -368,6 +375,12 @@ Item {
368375 menuData.label = data.label;
369376 menuData.sensitive = data.enabled;
370377 menuData.icon = data.icon;
378+ menuData.ext = {
379+ 'xCanonicalTime': data.time,
380+ 'xCanonicalTimeFormat': data.timeFormat
381+ };
382+ timeFormatter.format = data.timeFormat;
383+ timeFormatter.time = data.time;
371384
372385 loader.data = menuData;
373386 loader.sourceComponent = factory.load(menuData);
@@ -376,13 +389,16 @@ Item {
376389
377390 compare(loader.item.text, data.label, "Label does not match data");
378391 compare(loader.item.iconSource, data.icon, "Icon does not match data");
392+ compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
379393 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
380394 }
381395
382396 function test_create_appointmentMenu_data() {
383397 return [
384− {label: "testLabel1", enabled: true, icon: "file:///testIcon1" },
385− {label: "testLabel2", enabled: false, icon: "file:///testIcon2" },
398+ {label: "testLabel1", enabled: true, icon: "file:///testIcon1", color: Qt.rgba(0, 0, 0, 0),
399+ time: new Date(2014, 04, 14).getTime()*1000, timeFormat: "%a %d %b %l:%M %p"},
400+ {label: "testLabel2", enabled: false, icon: "file:///testIcon2", color: Qt.rgba(1, 0, 0, 0),
401+ time: new Date(2015, 12, 31).getTime()*1000, timeFormat: "%A" },
386402 ];
387403 }
388404
@@ -391,6 +407,13 @@ Item {
391407 menuData.label = data.label;
392408 menuData.sensitive = data.enabled;
393409 menuData.icon = data.icon;
410+ menuData.ext = {
411+ 'xCanonicalColor': data.colour,
412+ 'xCanonicalTime': data.time,
413+ 'xCanonicalTimeFormat': data.timeFormat
414+ };
415+ timeFormatter.format = data.timeFormat;
416+ timeFormatter.time = data.time;
394417
395418 loader.data = menuData;
396419 loader.sourceComponent = factory.load(menuData);
@@ -399,6 +422,8 @@ Item {
399422
400423 compare(loader.item.text, data.label, "Label does not match data");
401424 compare(loader.item.iconSource, data.icon, "Icon does not match data");
425+ compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
426+ compare(loader.item.eventColor, data.color, "Colour does not match data");
402427 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
403428 }
404429