on xenial help sign in
More robust test
21db4b0Andrea Cimitan
qml/Dash/Previews/TextSummary.qml+4
@@ -18,6 +18,10 @@ import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import "../../Components"
19import "../../Components"
20
20
21+/*! \brief Preview widget for text.
22+
23+ This widget shows an array */
24+
21PreviewWidget {
25PreviewWidget {
22 id: root
26 id: root
23
27
tests/qmltests/Dash/Previews/tst_TextSummary.qml+7−1
@@ -56,10 +56,15 @@ Rectangle {
56 var titleLabel = findChild(textSummary, "titleLabel")
56 var titleLabel = findChild(textSummary, "titleLabel")
57
57
58 textSummary.widgetData = widgetDataComplete
58 textSummary.widgetData = widgetDataComplete
59+
59 compare(titleLabel.visible, true)
60 compare(titleLabel.visible, true)
61+ var mappedTextLabel = root.mapFromItem(textLabel, 0, 0)
62+ compare(mappedTextLabel.y, titleLabel.height)
60
63
61 textSummary.widgetData = widgetDataNoTitle
64 textSummary.widgetData = widgetDataNoTitle
65+
62− tryCompare(titleLabel, "visible", false)
66+ compare(titleLabel.visible, false)
67+ verify(mappedTextLabel.y, 0)
63 }
68 }
64
69
65 function test_see_more() {
70 function test_see_more() {
@@ -74,6 +79,7 @@ Rectangle {
74 verify(textLabel.height < textLabel.contentHeight)
79 verify(textLabel.height < textLabel.contentHeight)
75
80
76 textSummary.widgetData = widgetDataShortText
81 textSummary.widgetData = widgetDataShortText
82+
77 verify(textLabel.lineCount <= 7)
83 verify(textLabel.lineCount <= 7)
78 compare(seeMore.visible, false)
84 compare(seeMore.visible, false)
79 tryCompare(textLabel, "height", textLabel.contentHeight)
85 tryCompare(textLabel, "height", textLabel.contentHeight)