on xenial help sign in
Fix bug in CardTool.titleAlignment

When components["title"] was an object it made it impossible to be left aligned

commit6d7b12834877bc0d95c5d05377fdc6678fa36e7d authorAlbert Astals Cid <albert.astals@canonical.com> dateMon 31 Aug 2015, 09:55 (11 years ago) parent60e02b5
2 files changed+7−2
qml/Dash/CardTool.qml+2−2 tests/qmltests/Dash/tst_CardTool.qml+5
qml/Dash/CardTool.qml+2−2
@@ -144,8 +144,8 @@ Item {
144144 */
145145 readonly property int titleAlignment: {
146146 if (template["card-layout"] === "horizontal"
147− || (typeof components["title"] !== "object" &&
148− components["title"]["align"] !== "center")) return Text.AlignLeft;
147+ || typeof components["title"] !== "object"
148+ || components["title"]["align"] !== "center") return Text.AlignLeft;
149149
150150 var keys = ["mascot", "emblem", "subtitle", "attributes", "summary"];
151151
tests/qmltests/Dash/tst_CardTool.qml+5
@@ -345,6 +345,11 @@ Rectangle {
345345 cardTool.componentsChanged();
346346
347347 tryCompare(cardTool, "titleAlignment", data.value);
348+
349+ cardTool.components['title'] = { "field": "title", "align": "left" };
350+ cardTool.componentsChanged();
351+
352+ tryCompare(cardTool, "titleAlignment", Text.AlignLeft);
348353 }
349354
350355 function test_categoryLayout_data() {