@@ -45,22 +45,30 @@ Rectangle {
50+ signalName: "triggered"
49 spacing: units.gu(1)
54 spacing: units.gu(1)
51 PreviewActions {
56 PreviewActions {
52 widgetId: "button"
58 widgetId: "button"
53 widgetData: actionDataOneAction
59 widgetData: actionDataOneAction
54 onTriggered: console.log("triggered", widgetId, actionId, data);
60 onTriggered: console.log("triggered", widgetId, actionId, data);
57 PreviewActions {
63 PreviewActions {
58 widgetId: "buttonAndCombo"
65 widgetId: "buttonAndCombo"
59 widgetData: actionDataFiveActions
66 widgetData: actionDataFiveActions
60 onTriggered: console.log("triggered", widgetId, actionId, data);
67 onTriggered: console.log("triggered", widgetId, actionId, data);
63 PreviewActions {
70 PreviewActions {
64 widgetId: "2buttons"
72 widgetId: "2buttons"
65 widgetData: actionDataTwoActions
73 widgetData: actionDataTwoActions
66 onTriggered: console.log("triggered", widgetId, actionId, data);
74 onTriggered: console.log("triggered", widgetId, actionId, data);
@@ -71,11 +79,50 @@ Rectangle {
71 name: "PreviewActionTest"
79 name: "PreviewActionTest"
72 when: windowShown
80 when: windowShown
74− function test_changeEmptyModel() {
82+ function checkButtonPressSignal(target, id, buttonNumber)
76−// imageGallery.widgetData = sourcesModel0;
84+ var button = findChild(root, "button" + id);
77−// var placeholderScreenshot = findChild(imageGallery, "placeholderScreenshot");
85+ verify(button != null);
78−// compare(placeholderScreenshot.visible, true);
86+ spy.target = target;
88+ mouseClick(button, button.width / 2, button.height / 2);
89+ compare(spy.count, 1);
90+ compare(spy.signalArguments[0][0], target.widgetId);
91+ compare(spy.signalArguments[0][1], id);
92+ compare(spy.signalArguments[0][2], target.widgetData["actions"][buttonNumber]);
95+ function test_checkButtons_data() {
97+ {tag: "oneActionButton", target: oneAction, id: "someid", buttonNumber: 0 },
98+ {tag: "twobuttonsButton0", target: twoActions, id: "someid1", buttonNumber: 0 },
99+ {tag: "twobuttonsButton1", target: twoActions, id: "someid2", buttonNumber: 1 },
100+ {tag: "buttonAndComboButton0", target: buttonAndCombo, id: "someid3", buttonNumber: 0 }
104+ function test_checkButtons(data) {
105+ checkButtonPressSignal(data.target, data.id, data.buttonNumber)
108+ function test_comboButton_data() {
110+ {tag: "button1", id: "someid4", buttonNumber: 1 },
111+ {tag: "button2", id: "someid5", buttonNumber: 2 },
112+ {tag: "button3", id: "someid6", buttonNumber: 3 },
113+ {tag: "button4", id: "someid7", buttonNumber: 4 }
117+ function test_comboButton(data) {
118+ var button = findChild(root, "moreLessButton");
119+ verify(button != null);
120+ var twoActionsY = twoActions.y
121+ mouseClick(button, button.width / 2, button.height / 2);
122+ tryCompareFunction(function () { return twoActions.y <= twoActionsY; }, false);
123+ checkButtonPressSignal(buttonAndCombo, data.id, data.buttonNumber);
124+ mouseClick(button, button.width / 2, button.height / 2);
125+ tryCompare(twoActions, "y", twoActionsY);