@@ -31,12 +31,6 @@ Rectangle {
3131 left: parent.left
3232 right: parent.right
3333 }
34−
35− source: Qt.resolvedUrl("MockPreviewWidget.qml")
36−
37− widgetData: {
38− "type": "mock"
39− }
4034 }
4135
4236 SignalSpy {
@@ -51,15 +45,23 @@ Rectangle {
5145
5246 property Item mockWidget: findChild(factory, "mockPreviewWidget")
5347
54− function init() {
55− verify(typeof mockWidget === "object", "Could not find the mock preview widget.");
48+ function cleanup() {
49+ factory.source = Qt.binding(function() { return factory.widgetSource });
5650 }
5751
5852 function test_previewData() {
53+ factory.source = Qt.resolvedUrl("MockPreviewWidget.qml");
54+
55+ verify(typeof mockWidget === "object", "Could not find the mock preview widget.");
56+
5957 tryCompare(mockWidget, "widgetData", factory.widgetData);
6058 }
6159
6260 function test_triggered() {
61+ factory.source = Qt.resolvedUrl("MockPreviewWidget.qml");
62+
63+ verify(typeof mockWidget === "object", "Could not find the mock preview widget.");
64+
6365 mockWidget.trigger();
6466
6567 triggeredSpy.wait();
@@ -70,5 +72,21 @@ Rectangle {
7072 compare(args[1], "mockAction", "Action id not passed correctly.");
7173 compare(args[2]["mock"], "data", "Data not passed correctly.");
7274 }
75+
76+ function test_mapping_data() {
77+ return [
78+ { tag: "Audio", type: "audio", source: "PreviewAudioPlayback.qml" },
79+ { tag: "Text", type: "text", source: "PreviewTextSummary.qml" },
80+ { tag: "Gallery", type: "gallery", source: "PreviewImageGallery.qml" },
81+ { tag: "Actions", type: "actions", source: "PreviewActions.qml" },
82+ ];
83+ }
84+
85+ function test_mapping(data) {
86+ factory.widgetData = { type: data.type };
87+ factory.widgetType = data.type;
88+
89+ verify(("" + factory.source).indexOf(data.source) != -1);
90+ }
7391 }
7492}