~lukas-kde/unity8/dashboard

« back to all changes in this revision

Viewing changes to tests/qmltests/Greeter/tst_NarrowView.qml

  • Committer: Lukáš Tinkl
  • Date: 2017-01-26 12:13:17 UTC
  • mfrom: (2749.1.49 unity8)
  • Revision ID: lukas.tinkl@canonical.com-20170126121317-qms39s9pikclidbe
merge trunk, fix conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import QtTest 1.0
19
19
import ".."
20
20
import "../../../qml/Greeter"
21
 
import LightDM.IntegratedLightDM 0.1 as LightDM
 
21
import LightDMController 0.1
 
22
import LightDM.FullLightDM 0.1 as LightDM
22
23
import Ubuntu.Components 1.3
23
24
import Ubuntu.Telephony 0.1 as Telephony
24
25
import Unity.Test 0.1 as UT
30
31
 
31
32
    Component.onCompleted: theme.name = "Ubuntu.Components.Themes.SuruDark" // use the same theme as the real shell
32
33
 
 
34
    Binding {
 
35
        target: LightDMController
 
36
        property: "userMode"
 
37
        value: "single"
 
38
    }
 
39
 
33
40
    Row {
34
41
        anchors.fill: parent
35
42
        Loader {
74
81
 
75
82
                Row {
76
83
                    Button {
77
 
                        text: "Show Last Chance"
78
 
                        onClicked: loader.item.showLastChance()
79
 
                    }
80
 
                }
81
 
                Row {
82
 
                    Button {
83
84
                        text: "Hide"
84
85
                        onClicked: loader.item.hide()
85
86
                    }
86
87
                }
87
88
                Row {
88
89
                    Button {
89
 
                        text: "Reset"
90
 
                        onClicked: loader.item.reset()
91
 
                    }
92
 
                }
93
 
                Row {
94
 
                    Button {
95
90
                        text: "Show Message"
96
 
                        onClicked: loader.item.showMessage(messageField.text)
 
91
                        onClicked: LightDMService.prompts.append(messageField.text, LightDMService.prompts.Message)
97
92
                    }
98
93
                    TextField {
99
94
                        id: messageField
104
99
                Row {
105
100
                    Button {
106
101
                        text: "Show Prompt"
107
 
                        onClicked: loader.item.showPrompt(promptField.text, isSecretCheckBox.checked, isDefaultPromptCheckBox.checked)
 
102
                        onClicked: LightDMService.prompts.append(promptField.text, isSecretCheckBox.checked ? LightDMService.prompts.Secret : LightDMService.prompts.Question)
108
103
                    }
109
104
                    TextField {
110
105
                        id: promptField
117
112
                    Label {
118
113
                        text: "secret"
119
114
                    }
120
 
                    CheckBox {
121
 
                        id: isDefaultPromptCheckBox
122
 
                    }
123
 
                    Label {
124
 
                        text: "default"
125
 
                    }
126
115
                }
127
116
                Row {
128
117
                    Button {
129
 
                        text: "Authenticated"
 
118
                        text: "Notify Auth Failure"
130
119
                        onClicked: {
131
 
                            if (successCheckBox.checked) {
132
 
                                loader.item.notifyAuthenticationSucceeded(fakePasswordCheckBox.checked);
133
 
                            } else {
134
 
                                loader.item.notifyAuthenticationFailed();
135
 
                            }
 
120
                            loader.item.notifyAuthenticationFailed();
136
121
                        }
137
122
                    }
138
 
                    CheckBox {
139
 
                        id: successCheckBox
140
 
                    }
141
 
                    Label {
142
 
                        text: "success"
143
 
                    }
144
 
                    CheckBox {
145
 
                        id: fakePasswordCheckBox
146
 
                    }
147
 
                    Label {
148
 
                        text: "fake password"
149
 
                    }
150
123
                }
151
124
                Row {
152
125
                    Button {
211
184
                Row {
212
185
                    CheckBox {
213
186
                        id: alphanumericCheckBox
 
187
                        checked: true
214
188
                    }
215
189
                    Label {
216
190
                        text: "alphanumeric"
252
226
    Binding {
253
227
        target: LightDM.Infographic
254
228
        property: "username"
255
 
        value: "single"
 
229
        value: "has-password"
256
230
    }
257
231
 
258
232
    SignalSpy {
294
268
        function init() {
295
269
            view.currentIndex = 0; // break binding with text field
296
270
 
 
271
            LightDM.Greeter.authenticate("no-password");
 
272
            tryCompare(LightDMService.prompts, "count", 1);
 
273
 
297
274
            telepathyHelper.ready = true;
298
275
            telepathyHelper.emergencyCallsAvailable = true;
299
276
            selectedSpy.clear();
358
335
        }
359
336
 
360
337
        function test_respondedWithPin() {
 
338
            LightDM.Greeter.authenticate("has-pin");
361
339
            view.locked = true;
362
 
            view.showPrompt("", true, true);
 
340
            view.alphanumeric = false;
363
341
            swipeAwayCover();
364
342
            typeString("1234");
365
343
            compare(respondedSpy.count, 1);
367
345
        }
368
346
 
369
347
        function test_respondedWithPassphrase() {
 
348
            LightDM.Greeter.authenticate("has-password");
370
349
            view.locked = true;
371
 
            view.alphanumeric = true;
372
 
            view.showPrompt("", true, true);
373
350
            swipeAwayCover();
374
351
            typeString("test");
375
352
            keyClick(Qt.Key_Enter);