@@ -24,42 +24,18 @@ Item {
2424 width: units.gu(60)
2525 height: units.gu(80)
2626
27− property var calls
27+ property var calls: []
28+ property int counter: 0
2829
29− function get_actions() {
30− var a1 = new Object();
31− a1.id = 123;
32− a1.displayName = "Play";
33− a1.iconHint = "image://theme/search";
34− var a2 = new Object();
35− a2.id = 456;
36− a2.displayName = "Buy";
37− a2.iconHint = "image://theme/search";
38− var a3 = new Object();
39− a3.id = 789;
40− a3.displayName = "Delete";
41− a3.iconHint = "image://theme/search";
42−
43− return [a1, a2, a3];
44− }
45−
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"
55− objData.rating = 3
56− objData.numRatings = 1
57− objData.execute = prueba;
58−
59− return objData;
30+ function get_actions_data() {
31+ return [
32+ { id: 123, displayName: "Play", iconHint: "image://theme/search" },
33+ { id: 456, displayName: "Buy", iconHint: "image://theme/search" },
34+ { id: 789, displayName: "Delete", iconHint: "image//theme/search" }
35+ ]
6036 }
6137
62− function prueba(id, data){
38+ function fake_callback(id, data){
6339 root.calls[root.calls.length] = id;
6440 }
6541
@@ -68,17 +44,30 @@ Item {
6844 id: moviePreview
6945 anchors.fill: parent
7046
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
58+ }
7259 }
7360
7461 UT.UnityTestCase {
7562 name: "MoviePreviewTest"
7663 when: windowShown
7764
78− function test_actions() {
65+ function init() {
7966 root.calls = new Array();
67+ }
68+
69+ function test_numofbuttons() {
8070 var buttons = findChild(moviePreview, "gridButtons");
81− wait(10000);
8271 compare(buttons.count, 3);
8372
8473 for(var i = 0; i < buttons.count; i++) {
@@ -86,7 +75,7 @@ Item {
8675 buttons.currentItem.clicked();
8776 }
8877
89− var actions = get_actions();
78+ var actions = get_actions_data();
9079 for(var i = 0; i < actions.length; i++) {
9180 compare(root.calls[i], actions[i].id);
9281 }