on xenial help sign in
Minimum number of items in the carousel is 5.
commitf014c5985d802544b25242eadef4ce2bac9c73dc authorMichał Karnicki <michal.karnicki@canonical.com> dateTue 28 Jan 2014, 12:45 (13 years ago) parentd808526
2 files changed+17−2
qml/Dash/GenericScopeView.qml+2−2 tests/qmltests/Dash/tst_GenericScopeView.qml+15
qml/Dash/GenericScopeView.qml+2−2
@@ -321,8 +321,8 @@ FocusScope {
321321 var layout = template["category-layout"];
322322
323323 if (layout === "carousel") {
324− // TODO: Selectively disable carousel, 6 is fixed for now, should change depending on form factor
325− if (results.count <= 6) layout = "grid";
324+ // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
325+ if (results.count <= 4) layout = "grid";
326326 }
327327 switch (layout) {
328328 case "carousel": return "CardCarousel.qml";
tests/qmltests/Dash/tst_GenericScopeView.qml+15
@@ -272,6 +272,21 @@ Item {
272272 tryCompare(category, "filtered", true);
273273 }
274274
275+ function test_getRendererCarouselGridFallback() {
276+ var template = new Object()
277+ template["category-layout"] = "carousel"
278+ var results = new Object()
279+ var renderer
280+
281+ results.count = 5
282+ renderer = genericScopeView.getRenderer(template, results)
283+ compare(renderer, "CardCarousel.qml")
284+
285+ results.count = 4
286+ renderer = genericScopeView.getRenderer(template, results)
287+ compare(renderer, "CardFilterGrid.qml")
288+ }
289+
275290 function test_showPreviewCarousel() {
276291 tryCompareFunction(function() { return findChild(genericScopeView, "carouselDelegate") != undefined; }, true);
277292 var tile = findChild(genericScopeView, "carouselDelegate");