on xenial help sign in
Added another test and comments
4f87ed0Andrea Cimitan
qml/Dash/Previews/TextSummary.qml+4−1
@@ -20,7 +20,10 @@ import "../../Components"
20
20
21/*! \brief Preview widget for text.
21/*! \brief Preview widget for text.
22
22
23− This widget shows an array */
23+ This widget shows text contained in widgetData["text"]
24+ along with a title that comes from widgetData["title"].
25+
26+ In case the text does not fit in 7 lines a See More / Less widget is also shown */
24
27
25PreviewWidget {
28PreviewWidget {
26 id: root
29 id: root
tests/qmltests/Components/tst_SeeMore.qml+4−4
@@ -37,15 +37,15 @@ Rectangle {
37 when: windowShown
37 when: windowShown
38
38
39 function test_interaction() {
39 function test_interaction() {
40− var seeMoreLabel = findChild(seeMore, "seeMoreLabel");
40+ var seeMoreLabel = findChild(seeMore, "seeMoreLabel")
41− var seeLessLabel = findChild(seeMore, "seeLessLabel");
41+ var seeLessLabel = findChild(seeMore, "seeLessLabel")
42
42
43 compare(seeMore.more, false)
43 compare(seeMore.more, false)
44
44
45− mouseClick(seeMoreLabel, seeMoreLabel.width / 2, seeMoreLabel.height / 2);
45+ mouseClick(seeMoreLabel, seeMoreLabel.width / 2, seeMoreLabel.height / 2)
46 compare(seeMore.more, true)
46 compare(seeMore.more, true)
47
47
48− mouseClick(seeLessLabel, seeLessLabel.width / 2, seeLessLabel.height / 2);
48+ mouseClick(seeLessLabel, seeLessLabel.width / 2, seeLessLabel.height / 2)
49 compare(seeMore.more, false)
49 compare(seeMore.more, false)
50 }
50 }
51 }
51 }
tests/qmltests/Dash/Previews/tst_TextSummary.qml+12
@@ -78,6 +78,18 @@ Rectangle {
78 verify(seeMore.more === false)
78 verify(seeMore.more === false)
79 verify(textLabel.height < textLabel.contentHeight)
79 verify(textLabel.height < textLabel.contentHeight)
80
80
81+ // test interactions with SeeMore
82+ var seeMoreLabel = findChild(seeMore, "seeMoreLabel")
83+ var seeLessLabel = findChild(seeMore, "seeLessLabel")
84+ var initialTextLabelHeight = textLabel.height
85+
86+ mouseClick(seeMoreLabel, seeMoreLabel.width / 2, seeMoreLabel.height / 2)
87+ tryCompare(textLabel, "height", textLabel.contentHeight)
88+
89+ mouseClick(seeLessLabel, seeLessLabel.width / 2, seeLessLabel.height / 2)
90+ tryCompare(textLabel, "height", initialTextLabelHeight)
91+
92+ // text SeeMore automatic hiding
81 textSummary.widgetData = widgetDataShortText
93 textSummary.widgetData = widgetDataShortText
82
94
83 verify(textLabel.lineCount <= 7)
95 verify(textLabel.lineCount <= 7)