on xenial help sign in
added a placeholder image if an app doesn't deliver any screenshot
635077dMichael Zanetti
Dash/Apps/AppPreview.qml+12
@@ -37,11 +37,23 @@ GenericPreview {
37 Component {
37 Component {
38 id: previewImagesComponent
38 id: previewImagesComponent
39 ListView {
39 ListView {
40+ id: previewImageListView
40 spacing: units.gu(1)
41 spacing: units.gu(1)
41 orientation: ListView.Horizontal
42 orientation: ListView.Horizontal
42 height: units.gu(22)
43 height: units.gu(22)
43 model: previewData.infoMap["more-screenshots"] != null ? previewData.infoMap["more-screenshots"].value : [previewData.image]
44 model: previewData.infoMap["more-screenshots"] != null ? previewData.infoMap["more-screenshots"].value : [previewData.image]
44
45
46+ LazyImage {
47+ objectName: "placeholderScreenshot"
48+ anchors {
49+ top: parent.top
50+ bottom: parent.bottom
51+ }
52+ scaleTo: "height"
53+ source: "broken_image"
54+ visible: previewImageListView.count == 0
55+ }
56+
45 delegate: LazyImage {
57 delegate: LazyImage {
46 id: shape
58 id: shape
47 anchors {
59 anchors {
tests/qmltests/Dash/Apps/tst_AppPreview.qml+13
@@ -254,5 +254,18 @@ Item {
254 compare(root.calls[0][0], actions[1].id, "Id of action not found.");
254 compare(root.calls[0][0], actions[1].id, "Id of action not found.");
255 compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
255 compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
256 }
256 }
257+
258+ function test_placeholderScreenshot() {
259+ var placeholderScreenshot = findChild(appPreview, "placeholderScreenshot");
260+ compare(placeholderScreenshot.visible, false);
261+
262+ data.infoMap["more-screenshots"] = [];
263+ appPreview.previewData = data;
264+ tryCompare(placeholderScreenshot, "visible", true);
265+
266+ data.infoMap["more-screenshots"] = screenshots;
267+ appPreview.previewData = data;
268+ tryCompare(placeholderScreenshot, "visible", false);
269+ }
257 }
270 }
258}
271}