on xenial help sign in
Fix cardtool test and make card creator output debugging info on errors.

Approved by: Andrea Cimitan, Daniel d'Andrada, PS Jenkins bot

commit8e00ae4eb8fd0c63e025bfc8bc8d3cf13fac0e81 authorMichał Sawicz <michal.sawicz@canonical.com> dateFri 15 Aug 2014, 17:37 (12 years ago) parent2e906c06f0c060
2 files changed+28−6
plugins/Dash/CardCreator.js+15−1 tests/qmltests/Dash/tst_CardTool.qml+13−5
plugins/Dash/CardCreator.js+15−1
@@ -639,7 +639,10 @@ function cardString(template, components) {
639639 implicitHeight += 'titleLabel.y + titleLabel.height + units.gu(1);\n';
640640 } else if (hasArt) {
641641 implicitHeight += 'artShapeHolder.height;\n';
642+ } else {
643+ implicitHeight = '';
642644 }
645+
643646 // Close the AbstractButton
644647 code += implicitHeight + '}\n';
645648
@@ -653,5 +656,16 @@ function createCardComponent(parent, template, components) {
653656 var card = cardString(template, components);
654657 var code = imports + 'Component {\n' + card + '}\n';
655658
656− return Qt.createQmlObject(code, parent, "createCardComponent");
659+ try {
660+ return Qt.createQmlObject(code, parent, "createCardComponent");
661+ } catch (e) {
662+ console.error("ERROR: Invalid component created.");
663+ console.error("Template:");
664+ console.error(JSON.stringify(template));
665+ console.error("Components:");
666+ console.error(JSON.stringify(components));
667+ console.error("Code:");
668+ console.error(code);
669+ throw e;
670+ }
657671}
tests/qmltests/Dash/tst_CardTool.qml+13−5
@@ -237,7 +237,7 @@ Rectangle {
237237
238238 UT.UnityTestCase {
239239 id: testCase
240− name: "Card"
240+ name: "CardTool"
241241
242242 property var internalCard: findChild(cardTool, "cardToolCard")
243243
@@ -272,10 +272,18 @@ Rectangle {
272272 { tag: "MediumCarousel", width: units.gu(22), height: units.gu(22), viewWidth: 84, index: 0, layout_index: 4},
273273 { tag: "LargeCarousel", width: units.gu(26), height: units.gu(26), viewWidth: 140, index: 0, layout_index: 4},
274274 { tag: "PortraitCarousel", width: units.gu(22), height: units.gu(44), viewWidth: 84, index: 10, layout_index: 4},
275− { tag: "SmallHorizontalList", width: units.gu(18), height: units.gu(39.5), viewWidth: 30, index: 0, layout_index: 5},
276− { tag: "MediumHorizontalList", width: units.gu(22), height: units.gu(43.5), viewWidth: 84, index: 0, layout_index: 5},
277− { tag: "LargeHorizontalList", width: units.gu(26), height: units.gu(47.5), viewWidth: 140, index: 0, layout_index: 5},
278− { tag: "PortraitHorizontalList", width: units.gu(22), height: units.gu(65.5), viewWidth: 84, index: 10, layout_index: 5},
275+ { tag: "SmallHorizontalList", width: units.gu(18),
276+ height: function() { return internalCard ? internalCard.height : 0 },
277+ viewWidth: 30, index: 0, layout_index: 5 },
278+ { tag: "MediumHorizontalList", width: units.gu(22),
279+ height: function() { return internalCard ? internalCard.height : 0 },
280+ viewWidth: 84, index: 0, layout_index: 5 },
281+ { tag: "LargeHorizontalList", width: units.gu(26),
282+ height: function() { return internalCard ? internalCard.height : 0 },
283+ viewWidth: 140, index: 0, layout_index: 5 },
284+ { tag: "PortraitHorizontalList", width: units.gu(22),
285+ height: function() { return internalCard ? internalCard.height : 0 },
286+ viewWidth: 84, index: 10, layout_index: 5 },
279287 ]
280288 }
281289