~aacid/unity8/image_gallery_preview_widget

« back to all changes in this revision

Viewing changes to tests/qmltests/Dash/Previews/tst_TextWidget.qml

  • Committer: Andrea Cimitan
  • Date: 2014-02-04 14:51:22 UTC
  • Revision ID: andrea.cimitan@gmail.com-20140204145122-6wahewk8vnxnlktq
Renamings

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.\nPhasellus a mi vitae augue rhoncus lobortis ut rutrum metus.\nCurabitur tortor leo, tristique sed mollis quis, condimentum venenatis nibh."
41
41
    }
42
42
 
43
 
    TextSummary {
44
 
        id: textSummary
 
43
    TextWidget {
 
44
        id: textWidget
45
45
        anchors.fill: parent
46
46
        widgetData: widgetDataComplete
47
47
    }
48
48
 
49
49
    UT.UnityTestCase {
50
 
        name: "TextSummaryTest"
 
50
        name: "TextWidgetTest"
51
51
        when: windowShown
52
52
 
53
 
        property var textLabel: findChild(textSummary, "textLabel")
 
53
        property var textLabel: findChild(textWidget, "textLabel")
54
54
 
55
55
        function test_optional_title() {
56
 
            var titleLabel = findChild(textSummary, "titleLabel")
 
56
            var titleLabel = findChild(textWidget, "titleLabel")
57
57
 
58
 
            textSummary.widgetData = widgetDataComplete
 
58
            textWidget.widgetData = widgetDataComplete
59
59
 
60
60
            compare(titleLabel.visible, true)
61
61
            var mappedTextLabel = root.mapFromItem(textLabel, 0, 0)
62
62
            compare(mappedTextLabel.y, titleLabel.height)
63
63
 
64
 
            textSummary.widgetData = widgetDataNoTitle
 
64
            textWidget.widgetData = widgetDataNoTitle
65
65
 
66
66
            compare(titleLabel.visible, false)
67
67
            verify(mappedTextLabel.y, 0)
68
68
        }
69
69
 
70
70
        function test_see_more() {
71
 
            var seeMore = findChild(textSummary, "seeMore")
 
71
            var seeMore = findChild(textWidget, "seeMore")
72
72
 
73
 
            textSummary.widgetData = widgetDataComplete
 
73
            textWidget.widgetData = widgetDataComplete
74
74
 
75
75
            // when it's more than 7 lines of text, show SeeMore component
76
76
            verify(textLabel.lineCount > 7)
90
90
            tryCompare(textLabel, "height", initialTextLabelHeight)
91
91
 
92
92
            // text SeeMore automatic hiding
93
 
            textSummary.widgetData = widgetDataShortText
 
93
            textWidget.widgetData = widgetDataShortText
94
94
 
95
95
            verify(textLabel.lineCount <= 7)
96
96
            compare(seeMore.visible, false)