diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-08 10:34:07 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-01-08 16:26:38 +0100 |
commit | 3ac6cf5ffae2247719730f328d1363c498e4ee83 (patch) | |
tree | dbef67a345ec412c58eff6275111df29de7fa742 /components | |
parent | e6f83f7b5af1ed3467d12f551fb7401238b7855e (diff) | |
download | kube-3ac6cf5ffae2247719730f328d1363c498e4ee83.tar.gz kube-3ac6cf5ffae2247719730f328d1363c498e4ee83.zip |
Dynamically setup initial test state
Diffstat (limited to 'components')
-rw-r--r-- | components/kube/tests/tst_composerview.qml | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/components/kube/tests/tst_composerview.qml b/components/kube/tests/tst_composerview.qml index b7b6b3df..d9cd2dfb 100644 --- a/components/kube/tests/tst_composerview.qml +++ b/components/kube/tests/tst_composerview.qml | |||
@@ -21,6 +21,7 @@ import QtQuick 2.7 | |||
21 | import QtTest 1.0 | 21 | import QtTest 1.0 |
22 | import "../qml" | 22 | import "../qml" |
23 | import org.kube.framework 1.0 as Kube | 23 | import org.kube.framework 1.0 as Kube |
24 | import org.kube.test 1.0 | ||
24 | 25 | ||
25 | TestCase { | 26 | TestCase { |
26 | id: testCase | 27 | id: testCase |
@@ -29,16 +30,20 @@ TestCase { | |||
29 | name: "ComposerView" | 30 | name: "ComposerView" |
30 | when: windowShown | 31 | when: windowShown |
31 | 32 | ||
32 | ComposerView { | 33 | Component { |
33 | id: composer | 34 | id:composerComponent |
34 | focus: true | 35 | ComposerView { |
36 | focus: true | ||
37 | } | ||
35 | } | 38 | } |
36 | 39 | ||
37 | function test_1start() { | 40 | function test_1start() { |
41 | var composer = createTemporaryObject(composerComponent, testCase, {}) | ||
38 | verify(composer) | 42 | verify(composer) |
39 | } | 43 | } |
40 | 44 | ||
41 | function test_2verifyInitialFocus() { | 45 | function test_2verifyInitialFocus() { |
46 | var composer = createTemporaryObject(composerComponent, testCase, {}) | ||
42 | var newMailButton = findChild(composer, "newMailButton"); | 47 | var newMailButton = findChild(composer, "newMailButton"); |
43 | verify(newMailButton) | 48 | verify(newMailButton) |
44 | verify(newMailButton.activeFocus) | 49 | verify(newMailButton.activeFocus) |
@@ -55,6 +60,29 @@ TestCase { | |||
55 | } | 60 | } |
56 | 61 | ||
57 | function test_3sendMessage() { | 62 | function test_3sendMessage() { |
63 | var initialState = { | ||
64 | accounts: [{ | ||
65 | id: "account1", | ||
66 | }], | ||
67 | identities: [{ | ||
68 | account: "account1", | ||
69 | name: "Test Identity", | ||
70 | address: "identity@example.org" | ||
71 | }], | ||
72 | resources: [{ | ||
73 | id: "resource1", | ||
74 | account: "account1", | ||
75 | type: "dummy" | ||
76 | }, | ||
77 | { | ||
78 | id: "resource2", | ||
79 | account: "account1", | ||
80 | type: "mailtransport" | ||
81 | }] | ||
82 | } | ||
83 | TestStore.setup(initialState) | ||
84 | var composer = createTemporaryObject(composerComponent, testCase, {}) | ||
85 | |||
58 | var domainObjectController = controllerComponent.createObject(null, {blocking: true}) | 86 | var domainObjectController = controllerComponent.createObject(null, {blocking: true}) |
59 | var mail = { | 87 | var mail = { |
60 | type: "mail", | 88 | type: "mail", |