~mterry/ubuntu-calculator-app/confined

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import QtQuick 2.0
import QtTest 1.0
import Ubuntu.Components 1.1
import "../../components"

// See more details @ http://qt-project.org/doc/qt-5.0/qtquick/qml-testcase.html

// Execute tests with:
//   qmltestrunner

Item {
    // The objects
    HelloComponent {
        id: objectUnderTest
    }

    TestCase {
        name: "HelloComponent"

        function init() {
            console.debug(">> init");
            compare("",objectUnderTest.text,"text was not empty on init");
            console.debug("<< init");
        }

        function cleanup() {
            console.debug(">> cleanup");
            console.debug("<< cleanup");
        }

        function initTestCase() {
            console.debug(">> initTestCase");
            console.debug("<< initTestCase");
        }

        function cleanupTestCase() {
            console.debug(">> cleanupTestCase");
            console.debug("<< cleanupTestCase");
        }

        function test_canReadAndWriteText() {
            var expected = "Hello World";

            objectUnderTest.text = expected;

            compare(expected,objectUnderTest.text,"expected did not equal result");
        }
    }
}