on xenial help sign in
Add a test to show the carousel shows preview when getting clicked on
commit5a7806789a80db30acb1b48f833dad91115a0e8f authorAlbert Astals <albert.astals@canonical.com> dateThu 5 Dec 2013, 18:01 (13 years ago) parent0b5080e
3 files changed+31−1
Dash/Generic/GenericCarousel.qml+1 tests/mocks/Unity/fake_scope.cpp+1−1 tests/qmltests/Dash/tst_GenericScopeView.qml+29
Dash/Generic/GenericCarousel.qml+1
@@ -28,6 +28,7 @@ DashCarousel {
2828
2929 BaseCarouselDelegate {
3030 id: item
31+ objectName: "carouselDelegate"
3132
3233 UbuntuShape {
3334 anchors.fill: parent
tests/mocks/Unity/fake_scope.cpp+1−1
@@ -204,7 +204,7 @@ DeeModel* create_categories_model(unsigned category_count) {
204204 std::to_string(i).c_str(),
205205 ("Category "+std::to_string(i)).c_str(),
206206 "gtk-apply",
207− "grid",
207+ i % 2 == 0 ? "grid" : "carousel",
208208 hints);
209209 }
210210 return category_model;
tests/qmltests/Dash/tst_GenericScopeView.qml+29
@@ -222,6 +222,35 @@ Item {
222222 genericScopeView.scope = scopes.get(0)
223223 tryCompare(genericScopeView.scope, "searchQuery", "")
224224 }
225+
226+ function test_showPreviewCarousel() {
227+ tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != undefined; }, true);
228+ var tile = findChild(genericScopeView, "carouselDelegate");
229+ mouseClick(tile, tile.width / 2, tile.height / 2);
230+ var openEffect = findChild(genericScopeView, "openEffect");
231+ tryCompare(openEffect, "gap", 1);
232+
233+ // check for it opening successfully
234+ var previewListView = findChild(genericScopeView, "previewListView");
235+ var currentPreviewItem = findChild(genericScopeView, "previewLoader0");
236+ tryCompareFunction(function() {
237+ var parts = currentPreviewItem.source.toString().split("/");
238+ var name = parts[parts.length - 1];
239+ return name == "DashPreviewPlaceholder.qml";
240+ },
241+ true);
242+ tryCompareFunction(function() {
243+ var parts = currentPreviewItem.source.toString().split("/");
244+ var name = parts[parts.length - 1];
245+ return name == "GenericPreview.qml";
246+ },
247+ true);
248+ tryCompare(currentPreviewItem, "progress", 1);
249+ tryCompare(previewListView, "open", true);
250+
251+ closePreview();
252+ tryCompare(previewListView, "open", false);
253+ }
225254 }
226255 }
227256}