on xenial help sign in
added a placeholder image if an app doesn't deliver any screenshot
commit635077daeb870d2d74af6ec1c4fac5cd42cc2529 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 2 Oct 2013, 16:38 (13 years ago) parent6321533
2 files changed+25
Dash/Apps/AppPreview.qml+12 tests/qmltests/Dash/Apps/tst_AppPreview.qml+13
Dash/Apps/AppPreview.qml+12
@@ -37,11 +37,23 @@ GenericPreview {
3737 Component {
3838 id: previewImagesComponent
3939 ListView {
40+ id: previewImageListView
4041 spacing: units.gu(1)
4142 orientation: ListView.Horizontal
4243 height: units.gu(22)
4344 model: previewData.infoMap["more-screenshots"] != null ? previewData.infoMap["more-screenshots"].value : [previewData.image]
4445
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+
4557 delegate: LazyImage {
4658 id: shape
4759 anchors {
tests/qmltests/Dash/Apps/tst_AppPreview.qml+13
@@ -254,5 +254,18 @@ Item {
254254 compare(root.calls[0][0], actions[1].id, "Id of action not found.");
255255 compare(root.calls[0][1], {"error": "DOWNLOAD ERROR"}, "Data of action not found.");
256256 }
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+ }
257270 }
258271}