@@ -24,42 +24,18 @@ Item {
24 width: units.gu(60)
24 width: units.gu(60)
25 height: units.gu(80)
25 height: units.gu(80)
27− property var calls
27+ property var calls: []
28+ property int counter: 0
29− function get_actions() {
30+ function get_actions_data() {
30− var a1 = new Object();
31+ return [
32− a1.displayName = "Play";
33− a1.iconHint = "image://theme/search";
32+ { id: 123, displayName: "Play", iconHint: "image://theme/search" },
34− var a2 = new Object();
36− a2.displayName = "Buy";
37− a2.iconHint = "image://theme/search";
33+ { id: 456, displayName: "Buy", iconHint: "image://theme/search" },
38− var a3 = new Object();
40− a3.displayName = "Delete";
34+ { id: 789, displayName: "Delete", iconHint: "image//theme/search" }
41− a3.iconHint = "image://theme/search";
35+ ]
46− function get_data() {
47− var objData = new Object();
48− objData.rendererName = "preview-movie";
49− objData.title = "Unity Movie";
50− objData.subtitle = "Subtitle";
51− objData.description = "This is the description";
52− objData.image = "image://theme/syncing";
53− objData.actions = get_actions();
54− objData.year = "2013"
56− objData.numRatings = 1
57− objData.execute = prueba;
62− function prueba(id, data){
38+ function fake_callback(id, data){
63 root.calls[root.calls.length] = id;
39 root.calls[root.calls.length] = id;
@@ -68,17 +44,30 @@ Item {
68 id: moviePreview
44 id: moviePreview
69 anchors.fill: parent
45 anchors.fill: parent
71− previewData: get_data()
47+ previewData: QtObject {
48+ property string rendererName: "preview-movie"
49+ property string title: "Unity Movie"
50+ property string subtitle: "Subtitle"
51+ property string description: "This is the description"
52+ property string image: "image://theme/syncing"
53+ property var actions: get_actions_data()
54+ property string year: "2013"
55+ property int rating: 3
56+ property int numRatings: 1
57+ property var execute: fake_callback
74 UT.UnityTestCase {
61 UT.UnityTestCase {
75 name: "MoviePreviewTest"
62 name: "MoviePreviewTest"
76 when: windowShown
63 when: windowShown
78− function test_actions() {
65+ function init() {
79 root.calls = new Array();
66 root.calls = new Array();
69+ function test_numofbuttons() {
80 var buttons = findChild(moviePreview, "gridButtons");
70 var buttons = findChild(moviePreview, "gridButtons");
82 compare(buttons.count, 3);
71 compare(buttons.count, 3);
84 for(var i = 0; i < buttons.count; i++) {
73 for(var i = 0; i < buttons.count; i++) {
@@ -86,7 +75,7 @@ Item {
86 buttons.currentItem.clicked();
75 buttons.currentItem.clicked();
89− var actions = get_actions();
78+ var actions = get_actions_data();
90 for(var i = 0; i < actions.length; i++) {
79 for(var i = 0; i < actions.length; i++) {
91 compare(root.calls[i], actions[i].id);
80 compare(root.calls[i], actions[i].id);