on xenial help sign in
Correctly refresh cardcreator cache on artshapestyle changes (LP: #1588335)
commitff9fe9595048405dddbabd1707f83ffbcb916547 authorAndrea Cimitan <andrea.cimitan@gmail.com> dateFri 17 Jun 2016, 01:17 (10 years ago) parent86f1dd54fcf8c6
3 files changed+21−4
plugins/Dash/CardCreatorCache.qml+1−1 qml/Dash/CardTool.qml+2−2 tests/qmltests/Dash/tst_Dash.qml+18−1
plugins/Dash/CardCreatorCache.qml+1−1
@@ -29,7 +29,7 @@ QtObject {
2929
3030 var tString = JSON.stringify(template);
3131 var cString = JSON.stringify(components);
32− var allString = tString + cString + isCardTool;
32+ var allString = tString + cString + isCardTool + artShapeStyle;
3333 var component = cache[allString];
3434 if (component === undefined) {
3535 component = CardCreator.createCardComponent(root, template, components, isCardTool, artShapeStyle, allString);
qml/Dash/CardTool.qml+2−2
@@ -70,7 +70,7 @@ Item {
7070 // Not readonly because gets overwritten from GenericScopeView in some cases
7171 property string artShapeStyle: categoryLayout === "carousel" ? "shadow" : "inset"
7272
73− property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false, artShapeStyle);
73+ property var cardComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, false, cardTool.artShapeStyle);
7474
7575 // FIXME: Saviq
7676 // Only way for the card below to actually be laid out completely.
@@ -212,7 +212,7 @@ Item {
212212 "attributes": attributesModel.model,
213213 "socialActions": socialActionsModel.model
214214 }
215− sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true, artShapeStyle);
215+ sourceComponent: CardCreatorCache.getCardComponent(cardTool.template, cardTool.components, true, cardTool.artShapeStyle);
216216 onLoaded: {
217217 item.objectName = "cardToolCard";
218218 item.width = Qt.binding(function() { return cardTool.cardWidth !== -1 ? cardTool.cardWidth : item.implicitWidth; });
tests/qmltests/Dash/tst_Dash.qml+18−1
@@ -88,7 +88,7 @@ Item {
8888 return findChild(genericScopeView, categoryName);
8989 }
9090
91− function clickCategoryDelegate(category, delegate) {
91+ function getCategoryDelegate(category, delegate) {
9292 var dashContentList = findChild(dash, "dashContentList");
9393 var genericScopeView = dashContentList.currentItem;
9494 if (category === undefined) category = 0;
@@ -104,6 +104,11 @@ Item {
104104 true);
105105 var tile = findChild(findChild(genericScopeView, "dashCategory"+category), "delegate"+delegate);
106106 waitForRendering(tile);
107+ return tile;
108+ }
109+
110+ function clickCategoryDelegate(category, delegate) {
111+ var tile = getCategoryDelegate(category, delegate);
107112 mouseClick(tile);
108113 }
109114
@@ -637,6 +642,18 @@ Item {
637642 tryCompare(dashContent, "x", 0);
638643 }
639644
645+ function test_cardIconStyle()
646+ {
647+ dash.setCurrentScope("clickscope");
648+ var dashContent = findChild(dash, "dashContent");
649+ tryCompare(dashContent.currentScope, "id", "clickscope");
650+
651+ scrollToCategory("dashCategorypredefined");
652+ var tile = getCategoryDelegate("predefined", 2);
653+ var proportionalShape = findChildsByType(tile, "UCProportionalShape");
654+ compare(proportionalShape.length, 1);
655+ }
656+
640657 function test_tempScopeItemXOnResize()
641658 {
642659 // Go to a temp scope