This file is indexed.

/usr/share/qt5/doc/qtquick/qml-qttest-testcase.html is in qtdeclarative5-doc-html 5.5.1-2ubuntu6.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TestCase.qml -->
  <title>TestCase QML Type | Qt Quick 5.5</title>
  <link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
    <div class="main">
    <div class="main-rounded">
        <div class="navigationbar">
        <ul>
<li>Qt 5.5</li>
<li><a href="qtquick-index.html">Qt Quick</a></li>
<li><a href="qtquick-qmlmodule.html">QML Types</a></li>
<li>TestCase QML Type</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
    </ul>
    </div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#introduction-to-qml-test-cases">Introduction to QML test cases</a></li>
<li class="level2"><a href="#data-driven-tests">Data-driven tests</a></li>
<li class="level2"><a href="#benchmarks">Benchmarks</a></li>
<li class="level2"><a href="#simulating-keyboard-and-mouse-events">Simulating keyboard and mouse events</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">TestCase QML Type</h1>
<span class="subtitle"></span>
<!-- $$$TestCase-brief -->
<p>Represents a unit test case <a href="#details">More...</a></p>
<!-- @@@TestCase -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Import Statement:</td><td class="memItemRight bottomAlign"> import QtTest 1.1</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign">  Qt 4.8</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-item.html">Item</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qttest-testcase-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#completed-prop">completed</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#name-prop">name</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#optional-prop">optional</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#running-prop">running</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#when-prop">when</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#windowShown-prop">windowShown</a></b></b> : bool</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#cleanup-method">cleanup</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#cleanupTestCase-method">cleanupTestCase</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#compare-method">compare</a></b></b>(<i> actual</i>,  <i> expected</i>,  <i> message</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#expectFail-method">expectFail</a></b></b>(<i> tag</i>,  <i> message</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#expectFailContinue-method">expectFailContinue</a></b></b>(<i> tag</i>,  <i> message</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#fail-method">fail</a></b></b>(<i> message</i>)</li>
<li class="fn">QtObject <b><b><a href="qml-qttest-testcase.html#findChild-method">findChild</a></b></b>(<i> parent</i>,  <i> objectName</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#fuzzyCompare-method">fuzzyCompare</a></b></b>(<i> actual</i>,  <i> expected</i>,  <i> delta</i>,  <i> message</i>)</li>
<li class="fn">object <b><b><a href="qml-qttest-testcase.html#grabImage-method">grabImage</a></b></b>(<i> item</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#ignoreWarning-method">ignoreWarning</a></b></b>(<i> message</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#init-method">init</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#initTestCase-method">initTestCase</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#keyClick-method">keyClick</a></b></b>(<i> key</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#keyPress-method">keyPress</a></b></b>(<i> key</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#keyRelease-method">keyRelease</a></b></b>(<i> key</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#mouseClick-method">mouseClick</a></b></b>(<i> item</i>,  <i> x</i>,  <i> y</i>,  <i> button</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick</a></b></b>(<i> item</i>,  <i> x</i>,  <i> y</i>,  <i> button</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence</a></b></b>(<i> item</i>,  <i> x</i>,  <i> y</i>,  <i> button</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#mouseDrag-method">mouseDrag</a></b></b>(<i> item</i>,  <i> x</i>,  <i> y</i>,  <i> dx</i>,  <i> dy</i>,  <i> button</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#mouseMove-method">mouseMove</a></b></b>(<i> item</i>,  <i> x</i>,  <i> y</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#mousePress-method">mousePress</a></b></b>(<i> item</i>,  <i> x</i>,  <i> y</i>,  <i> button</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease</a></b></b>(<i> item</i>,  <i> x</i>,  <i> y</i>,  <i> button</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#mouseWheel-method">mouseWheel</a></b></b>(<i> item</i>,  <i> x</i>,  <i> y</i>,  <i> xDelta</i>,  <i> yDelta</i>,  <i> button</i>,  <i> modifiers</i>,  <i> delay</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#skip-method">skip</a></b></b>(<i> message</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#sleep-method">sleep</a></b></b>(<i> ms</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#tryCompare-method">tryCompare</a></b></b>(<i> obj</i>,  <i> property</i>,  <i> expected</i>,  <i> timeout</i>,  <i> message</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#verify-method">verify</a></b></b>(<i> condition</i>,  <i> message</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#wait-method">wait</a></b></b>(<i> ms</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#waitForRendering-method">waitForRendering</a></b></b>(<i> item</i>,  <i> timeout</i>)</li>
<li class="fn"><b><b><a href="qml-qttest-testcase.html#warn-method">warn</a></b></b>(<i> message</i>)</li>
</ul>
<!-- $$$TestCase-description -->
<a name="details"></a>
<h2 id="details">Detailed Description</h2>
</p>
<a name="introduction-to-qml-test-cases"></a>
<h2 id="introduction-to-qml-test-cases">Introduction to QML test cases</h2>
<p>Test cases are written as JavaScript functions within a <a href="qml-qttest-testcase.html">TestCase</a> type:</p>
<pre class="cpp">import <span class="type"><a href="qtquick-module.html">QtQuick</a></span> <span class="number">2.0</span>
import <span class="type"><a href="qttest-qmlmodule.html">QtTest</a></span> <span class="number">1.0</span>

TestCase {
    name: <span class="string">&quot;MathTests&quot;</span>

    function test_math() {
        compare(<span class="number">2</span> <span class="operator">+</span> <span class="number">2</span><span class="operator">,</span> <span class="number">4</span><span class="operator">,</span> <span class="string">&quot;2 + 2 = 4&quot;</span>)
    }

    function test_fail() {
        compare(<span class="number">2</span> <span class="operator">+</span> <span class="number">2</span><span class="operator">,</span> <span class="number">5</span><span class="operator">,</span> <span class="string">&quot;2 + 2 = 5&quot;</span>)
    }
}</pre>
<p>Functions whose names start with &quot;test_&quot; are treated as test cases to be executed. The <a href="qml-qttest-testcase.html#name-prop">name</a> property is used to prefix the functions in the output:</p>
<pre class="cpp"><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span> Start testing of MathTests <span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span>
Config: Using <span class="type">QTest</span> library <span class="number">4.7.2</span><span class="operator">,</span> <span class="type">Qt</span> <span class="number">4.7.2</span>
PASS   : MathTests<span class="operator">::</span><a href="qml-qttest-testcase.html#initTestCase-method">initTestCase</a>()
FAIL<span class="operator">!</span>  : MathTests<span class="operator">::</span>test_fail() <span class="number">2</span> <span class="operator">+</span> <span class="number">2</span> <span class="operator">=</span> <span class="number">5</span>
   Actual (): <span class="number">4</span>
   Expected (): <span class="number">5</span>
   Loc: <span class="operator">[</span><span class="operator">/</span>home<span class="operator">/</span><span class="operator">.</span><span class="operator">.</span><span class="operator">.</span><span class="operator">/</span>tst_math<span class="operator">.</span>qml(<span class="number">12</span>)<span class="operator">]</span>
PASS   : MathTests<span class="operator">::</span>test_math()
PASS   : MathTests<span class="operator">::</span><a href="qml-qttest-testcase.html#cleanupTestCase-method">cleanupTestCase</a>()
Totals: <span class="number">3</span> passed<span class="operator">,</span> <span class="number">1</span> failed<span class="operator">,</span> <span class="number">0</span> skipped
<span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span> Finished testing of MathTests <span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span><span class="operator">*</span></pre>
<p>Because of the way JavaScript properties work, the order in which the test functions are found is unpredictable. To assist with predictability, the test framework will sort the functions on ascending order of name. This can help when there are two tests that must be run in order.</p>
<p>Multiple <a href="qml-qttest-testcase.html">TestCase</a> types can be supplied. The test program will exit once they have all completed. If a test case doesn't need to run (because a precondition has failed), then <a href="qml-qttest-testcase.html#optional-prop">optional</a> can be set to true.</p>
<a name="data-driven-tests"></a>
<h2 id="data-driven-tests">Data-driven tests</h2>
<p>Table data can be provided to a test using a function name that ends with &quot;_data&quot;. Alternatively, the <code>init_data()</code> function can be used to provide default test data for all test functions in a <a href="qml-qttest-testcase.html">TestCase</a> type:</p>
<pre class="cpp">import <span class="type"><a href="qtquick-module.html">QtQuick</a></span> <span class="number">2.0</span>
import <span class="type"><a href="qttest-qmlmodule.html">QtTest</a></span> <span class="number">1.1</span>

TestCase {
    name: <span class="string">&quot;DataTests&quot;</span>

    function init_data() {
      <span class="keyword">return</span> <span class="operator">[</span>
           {tag:<span class="string">&quot;init_data_1&quot;</span><span class="operator">,</span> a:<span class="number">1</span><span class="operator">,</span> b:<span class="number">2</span><span class="operator">,</span> answer: <span class="number">3</span>}<span class="operator">,</span>
           {tag:<span class="string">&quot;init_data_2&quot;</span><span class="operator">,</span> a:<span class="number">2</span><span class="operator">,</span> b:<span class="number">4</span><span class="operator">,</span> answer: <span class="number">6</span>}
      <span class="operator">]</span>;
    }

    function test_table_data() {
        <span class="keyword">return</span> <span class="operator">[</span>
            {tag: <span class="string">&quot;2 + 2 = 4&quot;</span><span class="operator">,</span> a: <span class="number">2</span><span class="operator">,</span> b: <span class="number">2</span><span class="operator">,</span> answer: <span class="number">4</span> }<span class="operator">,</span>
            {tag: <span class="string">&quot;2 + 6 = 8&quot;</span><span class="operator">,</span> a: <span class="number">2</span><span class="operator">,</span> b: <span class="number">6</span><span class="operator">,</span> answer: <span class="number">8</span> }<span class="operator">,</span>
        <span class="operator">]</span>
    }

    function test_table(data) {
        <span class="comment">//data comes from test_table_data</span>
        compare(data<span class="operator">.</span>a <span class="operator">+</span> data<span class="operator">.</span>b<span class="operator">,</span> data<span class="operator">.</span>answer)
    }

    function test__default_table(data) {
        <span class="comment">//data comes from init_data</span>
        compare(data<span class="operator">.</span>a <span class="operator">+</span> data<span class="operator">.</span>b<span class="operator">,</span> data<span class="operator">.</span>answer)
    }
}</pre>
<p>The test framework will iterate over all of the rows in the table and pass each row to the test function. As shown, the columns can be extracted for use in the test. The <code>tag</code> column is special - it is printed by the test framework when a row fails, to help the reader identify which case failed amongst a set of otherwise passing tests.</p>
<a name="benchmarks"></a>
<h2 id="benchmarks">Benchmarks</h2>
<p>Functions whose names start with &quot;benchmark_&quot; will be run multiple times with the Qt benchmark framework, with an average timing value reported for the runs. This is equivalent to using the <code>QBENCHMARK</code> macro in the C++ version of QTestLib.</p>
<pre class="cpp">TestCase {
    id: top
    name: <span class="string">&quot;CreateBenchmark&quot;</span>

    function benchmark_create_component() {
        var component <span class="operator">=</span> <span class="type">Qt</span><span class="operator">.</span>createComponent(<span class="string">&quot;item.qml&quot;</span>)
        var obj <span class="operator">=</span> component<span class="operator">.</span>createObject(top)
        obj<span class="operator">.</span>destroy()
        component<span class="operator">.</span>destroy()
    }
}

RESULT : CreateBenchmark<span class="operator">::</span>benchmark_create_component:
     <span class="number">0.23</span> msecs per iteration (total: <span class="number">60</span><span class="operator">,</span> iterations: <span class="number">256</span>)
PASS   : CreateBenchmark<span class="operator">::</span>benchmark_create_component()</pre>
<p>To get the effect of the <code>QBENCHMARK_ONCE</code> macro, prefix the test function name with &quot;benchmark_once_&quot;.</p>
<a name="simulating-keyboard-and-mouse-events"></a>
<h2 id="simulating-keyboard-and-mouse-events">Simulating keyboard and mouse events</h2>
<p>The <a href="qml-qttest-testcase.html#keyPress-method">keyPress()</a>, <a href="qml-qttest-testcase.html#keyRelease-method">keyRelease()</a>, and <a href="qml-qttest-testcase.html#keyClick-method">keyClick()</a> methods can be used to simulate keyboard events within unit tests. The events are delivered to the currently focused QML item. You can pass either a Qt.Key enum value or a latin1 char (string of length one)</p>
<pre class="cpp">Rectangle {
    width: <span class="number">50</span>; height: <span class="number">50</span>
    focus: <span class="keyword">true</span>

    TestCase {
        name: <span class="string">&quot;KeyClick&quot;</span>
        when: windowShown

        function test_key_click() {
            keyClick(<span class="type">Qt</span><span class="operator">.</span>Key_Left)
            keyClick(<span class="string">&quot;a&quot;</span>)
            <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
        }
    }
}</pre>
<p>The <a href="qml-qttest-testcase.html#mousePress-method">mousePress()</a>, <a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease()</a>, <a href="qml-qttest-testcase.html#mouseClick-method">mouseClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence()</a> and <a href="qml-qttest-testcase.html#mouseMove-method">mouseMove()</a> methods can be used to simulate mouse events in a similar fashion.</p>
<p><b>Note:</b> keyboard and mouse events can only be delivered once the main window has been shown. Attempts to deliver events before then will fail. Use the <a href="qml-qttest-testcase.html#when-prop">when</a> and <a href="qml-qttest-testcase.html#windowShown-prop">windowShown</a> properties to track when the main window has been shown.</p>
<p><b>See also </b><a href="qml-qttest-signalspy.html">SignalSpy</a> and Qt Quick Test Reference Documentation.</p>
<!-- @@@TestCase -->
<h2>Property Documentation</h2>
<!-- $$$completed -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="completed-prop"><td class="tblQmlPropNode"><p><a name="completed-prop"></a><span class="name">completed</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property will be set to true once the test case has completed execution. Test cases are only executed once. The initial value is false.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#running-prop">running</a> and <a href="qml-qttest-testcase.html#when-prop">when</a>.</p>
</div></div><!-- @@@completed -->
<br/>
<!-- $$$name -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="name-prop"><td class="tblQmlPropNode"><p><a name="name-prop"></a><span class="name">name</span> : <span class="type">string</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property defines the name of the test case for result reporting. The default is the empty string.</p>
<pre class="cpp">TestCase {
    name: <span class="string">&quot;ButtonTests&quot;</span>
    <span class="operator">.</span><span class="operator">.</span><span class="operator">.</span>
}</pre>
</div></div><!-- @@@name -->
<br/>
<!-- $$$optional -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="optional-prop"><td class="tblQmlPropNode"><p><a name="optional-prop"></a><span class="name">optional</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>Multiple <a href="qml-qttest-testcase.html">TestCase</a> types can be supplied in a test application. The application will exit once they have all completed. If a test case does not need to run (because a precondition has failed), then this property can be set to true. The default value is false.</p>
<pre class="cpp">TestCase {
    when: <span class="keyword">false</span>
    optional: <span class="keyword">true</span>
    function test_not_run() {
        verify(<span class="keyword">false</span>)
    }
}</pre>
<p><b>See also </b><a href="qml-qttest-testcase.html#when-prop">when</a> and <a href="qml-qttest-testcase.html#completed-prop">completed</a>.</p>
</div></div><!-- @@@optional -->
<br/>
<!-- $$$running -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="running-prop"><td class="tblQmlPropNode"><p><a name="running-prop"></a><span class="name">running</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property will be set to true while the test case is running. The initial value is false, and the value will become false again once the test case completes.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#completed-prop">completed</a> and <a href="qml-qttest-testcase.html#when-prop">when</a>.</p>
</div></div><!-- @@@running -->
<br/>
<!-- $$$when -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="when-prop"><td class="tblQmlPropNode"><p><a name="when-prop"></a><span class="name">when</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property should be set to true when the application wants the test cases to run. The default value is true. In the following example, a test is run when the user presses the mouse button:</p>
<pre class="cpp">Rectangle {
    id: foo
    width: <span class="number">640</span>; height: <span class="number">480</span>
    color: <span class="string">&quot;cyan&quot;</span>

    MouseArea {
        id: area
        anchors<span class="operator">.</span>fill: parent
    }

    property bool bar: <span class="keyword">true</span>

    TestCase {
        name: <span class="string">&quot;ItemTests&quot;</span>
        when: area<span class="operator">.</span>pressed
        id: test1

        function test_bar() {
            verify(bar)
        }
    }
}</pre>
<p>The test application will exit once all <a href="qml-qttest-testcase.html">TestCase</a> types have been triggered and have run. The <a href="qml-qttest-testcase.html#optional-prop">optional</a> property can be used to exclude a <a href="qml-qttest-testcase.html">TestCase</a> type.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#optional-prop">optional</a> and <a href="qml-qttest-testcase.html#completed-prop">completed</a>.</p>
</div></div><!-- @@@when -->
<br/>
<!-- $$$windowShown -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="windowShown-prop"><td class="tblQmlPropNode"><p><a name="windowShown-prop"></a><span class="name">windowShown</span> : <span class="type">bool</span></p></td></tr></table></div></div><div class="qmldoc"><p>This property will be set to true after the QML viewing window has been displayed. Normally test cases run as soon as the test application is loaded and before a window is displayed. If the test case involves visual types and behaviors, then it may need to be delayed until after the window is shown.</p>
<pre class="cpp">Button {
    id: button
    onClicked: text <span class="operator">=</span> <span class="string">&quot;Clicked&quot;</span>
    TestCase {
        name: <span class="string">&quot;ClickTest&quot;</span>
        when: windowShown
        function test_click() {
            button<span class="operator">.</span>clicked();
            compare(button<span class="operator">.</span>text<span class="operator">,</span> <span class="string">&quot;Clicked&quot;</span>);
        }
    }
}</pre>
</div></div><!-- @@@windowShown -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$cleanup -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="cleanup-method"><td class="tblQmlFuncNode"><p><a name="cleanup-method"></a><span class="name">cleanup</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>This function is called after each test function that is executed in the <a href="qml-qttest-testcase.html">TestCase</a> type. The default implementation does nothing. The application can provide its own implementation to perform cleanup after each test function.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#init-method">init()</a> and <a href="qml-qttest-testcase.html#cleanupTestCase-method">cleanupTestCase()</a>.</p>
</div></div><!-- @@@cleanup -->
<br/>
<!-- $$$cleanupTestCase -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="cleanupTestCase-method"><td class="tblQmlFuncNode"><p><a name="cleanupTestCase-method"></a><span class="name">cleanupTestCase</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>This function is called after all other test functions in the <a href="qml-qttest-testcase.html">TestCase</a> type have completed. The default implementation does nothing. The application can provide its own implementation to perform test case cleanup.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#initTestCase-method">initTestCase()</a> and <a href="qml-qttest-testcase.html#cleanup-method">cleanup()</a>.</p>
</div></div><!-- @@@cleanupTestCase -->
<br/>
<!-- $$$compare -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="compare-method"><td class="tblQmlFuncNode"><p><a name="compare-method"></a><span class="name">compare</span>(<i> actual</i>, <i> expected</i>, <i> message</i> = &quot;&quot;)</p></td></tr></table></div></div><div class="qmldoc"><p>Fails the current test case if <i>actual</i> is not the same as <i>expected</i>, and displays the optional <i>message</i>. Similar to <code>QCOMPARE(actual, expected)</code> in C++.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#tryCompare-method">tryCompare()</a> and <a href="qml-qttest-testcase.html#fuzzyCompare-method">fuzzyCompare</a>.</p>
</div></div><!-- @@@compare -->
<br/>
<!-- $$$expectFail -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="expectFail-method"><td class="tblQmlFuncNode"><p><a name="expectFail-method"></a><span class="name">expectFail</span>(<i> tag</i>, <i> message</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>In a data-driven test, marks the row associated with <i>tag</i> as expected to fail. When the fail occurs, display the <i>message</i>, abort the test, and mark the test as passing. Similar to <code>QEXPECT_FAIL(tag, message, Abort)</code> in C++.</p>
<p>If the test is not data-driven, then <i>tag</i> must be set to the empty string.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#expectFailContinue-method">expectFailContinue()</a>.</p>
</div></div><!-- @@@expectFail -->
<br/>
<!-- $$$expectFailContinue -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="expectFailContinue-method"><td class="tblQmlFuncNode"><p><a name="expectFailContinue-method"></a><span class="name">expectFailContinue</span>(<i> tag</i>, <i> message</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>In a data-driven test, marks the row associated with <i>tag</i> as expected to fail. When the fail occurs, display the <i>message</i>, and then continue the test. Similar to <code>QEXPECT_FAIL(tag, message, Continue)</code> in C++.</p>
<p>If the test is not data-driven, then <i>tag</i> must be set to the empty string.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#expectFail-method">expectFail()</a>.</p>
</div></div><!-- @@@expectFailContinue -->
<br/>
<!-- $$$fail -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="fail-method"><td class="tblQmlFuncNode"><p><a name="fail-method"></a><span class="name">fail</span>(<i> message</i> = &quot;&quot;)</p></td></tr></table></div></div><div class="qmldoc"><p>Fails the current test case, with the optional <i>message</i>. Similar to <code>QFAIL(message)</code> in C++.</p>
</div></div><!-- @@@fail -->
<br/>
<!-- $$$findChild -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="findChild-method"><td class="tblQmlFuncNode"><p><a name="findChild-method"></a><span class="type">QtObject</span> <span class="name">findChild</span>(<i> parent</i>, <i> objectName</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Returns the first child of <i>parent</i> with <i>objectName</i>, or <code>null</code> if no such item exists. Both visual and non-visual children are searched recursively, with visual children being searched first.</p>
<pre class="cpp"><a href="qml-qttest-testcase.html#compare-method">compare</a>(findChild(item<span class="operator">,</span> <span class="string">&quot;childObject&quot;</span>)<span class="operator">,</span> expectedChildObject);</pre>
<p>This QML method was introduced in  Qt 5.4.</p>
</div></div><!-- @@@findChild -->
<br/>
<!-- $$$fuzzyCompare -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="fuzzyCompare-method"><td class="tblQmlFuncNode"><p><a name="fuzzyCompare-method"></a><span class="name">fuzzyCompare</span>(<i> actual</i>, <i> expected</i>, <i> delta</i>, <i> message</i> = &quot;&quot;)</p></td></tr></table></div></div><div class="qmldoc"><p>Fails the current test case if the difference betwen <i>actual</i> and <i>expected</i> is greater than <i>delta</i>, and displays the optional <i>message</i>. Similar to <code>qFuzzyCompare(actual, expected)</code> in C++ but with a required <i>delta</i> value.</p>
<p>This function can also be used for color comparisons if both the <i>actual</i> and <i>expected</i> values can be converted into color values. If any of the differences for RGBA channel values are greater than <i>delta</i>, the test fails.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#tryCompare-method">tryCompare()</a> and <a href="qml-qttest-testcase.html#compare-method">compare()</a>.</p>
</div></div><!-- @@@fuzzyCompare -->
<br/>
<!-- $$$grabImage -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="grabImage-method"><td class="tblQmlFuncNode"><p><a name="grabImage-method"></a><span class="type">object</span> <span class="name">grabImage</span>(<i> item</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Returns a snapshot image object of the given <i>item</i>.</p>
<p>The returned image object has the following methods:</p>
<ul>
<li>red(x, y) Returns the red channel value of the pixel at <i>x</i>, <i>y</i> position</li>
<li>green(x, y) Returns the green channel value of the pixel at <i>x</i>, <i>y</i> position</li>
<li>blue(x, y) Returns the blue channel value of the pixel at <i>x</i>, <i>y</i> position</li>
<li>alpha(x, y) Returns the alpha channel value of the pixel at <i>x</i>, <i>y</i> position</li>
<li>pixel(x, y) Returns the color value of the pixel at <i>x</i>, <i>y</i> position For example:<pre class="cpp">var image <span class="operator">=</span> grabImage(rect);
<a href="qml-qttest-testcase.html#compare-method">compare</a>(image<span class="operator">.</span>red(<span class="number">10</span><span class="operator">,</span> <span class="number">10</span>)<span class="operator">,</span> <span class="number">255</span>);
<a href="qml-qttest-testcase.html#compare-method">compare</a>(image<span class="operator">.</span>pixel(<span class="number">20</span><span class="operator">,</span> <span class="number">20</span>)<span class="operator">,</span> <span class="type">Qt</span><span class="operator">.</span>rgba(<span class="number">255</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">255</span>));</pre>
</li>
</ul>
</div></div><!-- @@@grabImage -->
<br/>
<!-- $$$ignoreWarning -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="ignoreWarning-method"><td class="tblQmlFuncNode"><p><a name="ignoreWarning-method"></a><span class="name">ignoreWarning</span>(<i> message</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Marks <i>message</i> as an ignored warning message. When it occurs, the warning will not be printed and the test passes. If the message does not occur, then the test will fail. Similar to <code>QTest::ignoreMessage(QtWarningMsg, message)</code> in C++.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#warn-method">warn()</a>.</p>
</div></div><!-- @@@ignoreWarning -->
<br/>
<!-- $$$init -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="init-method"><td class="tblQmlFuncNode"><p><a name="init-method"></a><span class="name">init</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>This function is called before each test function that is executed in the <a href="qml-qttest-testcase.html">TestCase</a> type. The default implementation does nothing. The application can provide its own implementation to perform initialization before each test function.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#cleanup-method">cleanup()</a> and <a href="qml-qttest-testcase.html#initTestCase-method">initTestCase()</a>.</p>
</div></div><!-- @@@init -->
<br/>
<!-- $$$initTestCase -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="initTestCase-method"><td class="tblQmlFuncNode"><p><a name="initTestCase-method"></a><span class="name">initTestCase</span>()</p></td></tr></table></div></div><div class="qmldoc"><p>This function is called before any other test functions in the <a href="qml-qttest-testcase.html">TestCase</a> type. The default implementation does nothing. The application can provide its own implementation to perform test case initialization.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#cleanupTestCase-method">cleanupTestCase()</a> and <a href="qml-qttest-testcase.html#init-method">init()</a>.</p>
</div></div><!-- @@@initTestCase -->
<br/>
<!-- $$$keyClick -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="keyClick-method"><td class="tblQmlFuncNode"><p><a name="keyClick-method"></a><span class="name">keyClick</span>(<i> key</i>, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates clicking of <i>key</i> with an optional <i>modifier</i> on the currently focused item. If <i>delay</i> is larger than 0, the test will wait for <i>delay</i> milliseconds.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#keyPress-method">keyPress()</a> and <a href="qml-qttest-testcase.html#keyRelease-method">keyRelease()</a>.</p>
</div></div><!-- @@@keyClick -->
<br/>
<!-- $$$keyPress -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="keyPress-method"><td class="tblQmlFuncNode"><p><a name="keyPress-method"></a><span class="name">keyPress</span>(<i> key</i>, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates pressing a <i>key</i> with an optional <i>modifier</i> on the currently focused item. If <i>delay</i> is larger than 0, the test will wait for <i>delay</i> milliseconds.</p>
<p><b>Note:</b> At some point you should release the key using <a href="qml-qttest-testcase.html#keyRelease-method">keyRelease()</a>.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#keyRelease-method">keyRelease()</a> and <a href="qml-qttest-testcase.html#keyClick-method">keyClick()</a>.</p>
</div></div><!-- @@@keyPress -->
<br/>
<!-- $$$keyRelease -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="keyRelease-method"><td class="tblQmlFuncNode"><p><a name="keyRelease-method"></a><span class="name">keyRelease</span>(<i> key</i>, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates releasing a <i>key</i> with an optional <i>modifier</i> on the currently focused item. If <i>delay</i> is larger than 0, the test will wait for <i>delay</i> milliseconds.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#keyPress-method">keyPress()</a> and <a href="qml-qttest-testcase.html#keyClick-method">keyClick()</a>.</p>
</div></div><!-- @@@keyRelease -->
<br/>
<!-- $$$mouseClick -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="mouseClick-method"><td class="tblQmlFuncNode"><p><a name="mouseClick-method"></a><span class="name">mouseClick</span>(<i> item</i>, <i> x</i> = item.width / 2, <i> y</i> = item.height / 2, <i> button</i> = Qt.LeftButton, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates clicking a mouse <i>button</i> with an optional <i>modifier</i> on an <i>item</i>. The position of the click is defined by <i>x</i> and <i>y</i>. If <i>x</i> and <i>y</i> are not defined the position will be the center of <i>item</i>. If <i>delay</i> is specified, the test will wait for the specified amount of milliseconds before pressing and before releasing the button.</p>
<p>The position given by <i>x</i> and <i>y</i> is transformed from the co-ordinate system of <i>item</i> into window co-ordinates and then delivered. If <i>item</i> is obscured by another item, or a child of <i>item</i> occupies that position, then the event will be delivered to the other item instead.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#mousePress-method">mousePress()</a>, <a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence()</a>, <a href="qml-qttest-testcase.html#mouseMove-method">mouseMove()</a>, <a href="qml-qttest-testcase.html#mouseDrag-method">mouseDrag()</a>, and <a href="qml-qttest-testcase.html#mouseWheel-method">mouseWheel()</a>.</p>
</div></div><!-- @@@mouseClick -->
<br/>
<!-- $$$mouseDoubleClick -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="mouseDoubleClick-method"><td class="tblQmlFuncNode"><p><a name="mouseDoubleClick-method"></a><span class="name">mouseDoubleClick</span>(<i> item</i>, <i> x</i> = item.width / 2, <i> y</i> = item.height / 2, <i> button</i> = Qt.LeftButton, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates double-clicking a mouse <i>button</i> with an optional <i>modifier</i> on an <i>item</i>. The position of the click is defined by <i>x</i> and <i>y</i>. If <i>x</i> and <i>y</i> are not defined the position will be the center of <i>item</i>. If <i>delay</i> is specified, the test will wait for the specified amount of milliseconds before pressing and before releasing the button.</p>
<p>The position given by <i>x</i> and <i>y</i> is transformed from the co-ordinate system of <i>item</i> into window co-ordinates and then delivered. If <i>item</i> is obscured by another item, or a child of <i>item</i> occupies that position, then the event will be delivered to the other item instead.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence()</a>, <a href="qml-qttest-testcase.html#mousePress-method">mousePress()</a>, <a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease()</a>, <a href="qml-qttest-testcase.html#mouseClick-method">mouseClick()</a>, <a href="qml-qttest-testcase.html#mouseMove-method">mouseMove()</a>, <a href="qml-qttest-testcase.html#mouseDrag-method">mouseDrag()</a>, and <a href="qml-qttest-testcase.html#mouseWheel-method">mouseWheel()</a>.</p>
</div></div><!-- @@@mouseDoubleClick -->
<br/>
<!-- $$$mouseDoubleClickSequence -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="mouseDoubleClickSequence-method"><td class="tblQmlFuncNode"><p><a name="mouseDoubleClickSequence-method"></a><span class="name">mouseDoubleClickSequence</span>(<i> item</i>, <i> x</i> = item.width / 2, <i> y</i> = item.height / 2, <i> button</i> = Qt.LeftButton, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates the full sequence of events generated by double-clicking a mouse <i>button</i> with an optional <i>modifier</i> on an <i>item</i>.</p>
<p>This method reproduces the sequence of mouse events generated when a user makes a double click: Press-Release-Press-DoubleClick-Release.</p>
<p>The position of the click is defined by <i>x</i> and <i>y</i>. If <i>x</i> and <i>y</i> are not defined the position will be the center of <i>item</i>. If <i>delay</i> is specified, the test will wait for the specified amount of milliseconds before pressing and before releasing the button.</p>
<p>The position given by <i>x</i> and <i>y</i> is transformed from the co-ordinate system of <i>item</i> into window co-ordinates and then delivered. If <i>item</i> is obscured by another item, or a child of <i>item</i> occupies that position, then the event will be delivered to the other item instead.</p>
<p>This QML method was introduced in Qt 5.5&#x2e;</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick()</a>, <a href="qml-qttest-testcase.html#mousePress-method">mousePress()</a>, <a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease()</a>, <a href="qml-qttest-testcase.html#mouseClick-method">mouseClick()</a>, <a href="qml-qttest-testcase.html#mouseMove-method">mouseMove()</a>, <a href="qml-qttest-testcase.html#mouseDrag-method">mouseDrag()</a>, and <a href="qml-qttest-testcase.html#mouseWheel-method">mouseWheel()</a>.</p>
</div></div><!-- @@@mouseDoubleClickSequence -->
<br/>
<!-- $$$mouseDrag -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="mouseDrag-method"><td class="tblQmlFuncNode"><p><a name="mouseDrag-method"></a><span class="name">mouseDrag</span>(<i> item</i>, <i> x</i>, <i> y</i>, <i> dx</i>, <i> dy</i>, <i> button</i> = Qt.LeftButton, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates dragging the mouse on an <i>item</i> with <i>button</i> pressed and an optional <i>modifier</i>. The initial drag position is defined by <i>x</i> and <i>y</i>, and drag distance is defined by <i>dx</i> and <i>dy</i>. If <i>delay</i> is specified, the test will wait for the specified amount of milliseconds before releasing the button.</p>
<p>The position given by <i>x</i> and <i>y</i> is transformed from the co-ordinate system of <i>item</i> into window co-ordinates and then delivered. If <i>item</i> is obscured by another item, or a child of <i>item</i> occupies that position, then the event will be delivered to the other item instead.</p>
<p>Note: this method does not imply a drop action, to make a drop, an additional <a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease</a>(item, x + dx, y + dy) is needed.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#mousePress-method">mousePress()</a>, <a href="qml-qttest-testcase.html#mouseClick-method">mouseClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence()</a>, <a href="qml-qttest-testcase.html#mouseMove-method">mouseMove()</a>, <a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease()</a>, and <a href="qml-qttest-testcase.html#mouseWheel-method">mouseWheel()</a>.</p>
</div></div><!-- @@@mouseDrag -->
<br/>
<!-- $$$mouseMove -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="mouseMove-method"><td class="tblQmlFuncNode"><p><a name="mouseMove-method"></a><span class="name">mouseMove</span>(<i> item</i>, <i> x</i>, <i> y</i>, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Moves the mouse pointer to the position given by <i>x</i> and <i>y</i> within <i>item</i>. If a <i>delay</i> (in milliseconds) is given, the test will wait before moving the mouse pointer.</p>
<p>The position given by <i>x</i> and <i>y</i> is transformed from the co-ordinate system of <i>item</i> into window co-ordinates and then delivered. If <i>item</i> is obscured by another item, or a child of <i>item</i> occupies that position, then the event will be delivered to the other item instead.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#mousePress-method">mousePress()</a>, <a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease()</a>, <a href="qml-qttest-testcase.html#mouseClick-method">mouseClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence()</a>, <a href="qml-qttest-testcase.html#mouseDrag-method">mouseDrag()</a>, and <a href="qml-qttest-testcase.html#mouseWheel-method">mouseWheel()</a>.</p>
</div></div><!-- @@@mouseMove -->
<br/>
<!-- $$$mousePress -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="mousePress-method"><td class="tblQmlFuncNode"><p><a name="mousePress-method"></a><span class="name">mousePress</span>(<i> item</i>, <i> x</i> = item.width / 2, <i> y</i> = item.height / 2, <i> button</i> = Qt.LeftButton, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates pressing a mouse <i>button</i> with an optional <i>modifier</i> on an <i>item</i>. The position is defined by <i>x</i> and <i>y</i>. If <i>x</i> or <i>y</i> are not defined the position will be the center of <i>item</i>. If <i>delay</i> is specified, the test will wait for the specified amount of milliseconds before the press.</p>
<p>The position given by <i>x</i> and <i>y</i> is transformed from the co-ordinate system of <i>item</i> into window co-ordinates and then delivered. If <i>item</i> is obscured by another item, or a child of <i>item</i> occupies that position, then the event will be delivered to the other item instead.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease()</a>, <a href="qml-qttest-testcase.html#mouseClick-method">mouseClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence()</a>, <a href="qml-qttest-testcase.html#mouseMove-method">mouseMove()</a>, <a href="qml-qttest-testcase.html#mouseDrag-method">mouseDrag()</a>, and <a href="qml-qttest-testcase.html#mouseWheel-method">mouseWheel()</a>.</p>
</div></div><!-- @@@mousePress -->
<br/>
<!-- $$$mouseRelease -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="mouseRelease-method"><td class="tblQmlFuncNode"><p><a name="mouseRelease-method"></a><span class="name">mouseRelease</span>(<i> item</i>, <i> x</i> = item.width / 2, <i> y</i> = item.height / 2, <i> button</i> = Qt.LeftButton, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates releasing a mouse <i>button</i> with an optional <i>modifier</i> on an <i>item</i>. The position of the release is defined by <i>x</i> and <i>y</i>. If <i>x</i> or <i>y</i> are not defined the position will be the center of <i>item</i>. If <i>delay</i> is specified, the test will wait for the specified amount of milliseconds before releasing the button.</p>
<p>The position given by <i>x</i> and <i>y</i> is transformed from the co-ordinate system of <i>item</i> into window co-ordinates and then delivered. If <i>item</i> is obscured by another item, or a child of <i>item</i> occupies that position, then the event will be delivered to the other item instead.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#mousePress-method">mousePress()</a>, <a href="qml-qttest-testcase.html#mouseClick-method">mouseClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence()</a>, <a href="qml-qttest-testcase.html#mouseMove-method">mouseMove()</a>, <a href="qml-qttest-testcase.html#mouseDrag-method">mouseDrag()</a>, and <a href="qml-qttest-testcase.html#mouseWheel-method">mouseWheel()</a>.</p>
</div></div><!-- @@@mouseRelease -->
<br/>
<!-- $$$mouseWheel -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="mouseWheel-method"><td class="tblQmlFuncNode"><p><a name="mouseWheel-method"></a><span class="name">mouseWheel</span>(<i> item</i>, <i> x</i>, <i> y</i>, <i> xDelta</i>, <i> yDelta</i>, <i> button</i> = Qt.LeftButton, <i> modifiers</i> = Qt.NoModifier, <i> delay</i> = -1)</p></td></tr></table></div></div><div class="qmldoc"><p>Simulates rotating the mouse wheel on an <i>item</i> with <i>button</i> pressed and an optional <i>modifier</i>. The position of the wheel event is defined by <i>x</i> and <i>y</i>. If <i>delay</i> is specified, the test will wait for the specified amount of milliseconds before releasing the button.</p>
<p>The position given by <i>x</i> and <i>y</i> is transformed from the co-ordinate system of <i>item</i> into window co-ordinates and then delivered. If <i>item</i> is obscured by another item, or a child of <i>item</i> occupies that position, then the event will be delivered to the other item instead.</p>
<p>The <i>xDelta</i> and <i>yDelta</i> contain the wheel rotation distance in eighths of a degree. see QWheelEvent::angleDelta() for more details.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#mousePress-method">mousePress()</a>, <a href="qml-qttest-testcase.html#mouseClick-method">mouseClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClick-method">mouseDoubleClick()</a>, <a href="qml-qttest-testcase.html#mouseDoubleClickSequence-method">mouseDoubleClickSequence()</a>, <a href="qml-qttest-testcase.html#mouseMove-method">mouseMove()</a>, <a href="qml-qttest-testcase.html#mouseRelease-method">mouseRelease()</a>, <a href="qml-qttest-testcase.html#mouseDrag-method">mouseDrag()</a>, and QWheelEvent::angleDelta().</p>
</div></div><!-- @@@mouseWheel -->
<br/>
<!-- $$$skip -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="skip-method"><td class="tblQmlFuncNode"><p><a name="skip-method"></a><span class="name">skip</span>(<i> message</i> = &quot;&quot;)</p></td></tr></table></div></div><div class="qmldoc"><p>Skips the current test case and prints the optional <i>message</i>. If this is a data-driven test, then only the current row is skipped. Similar to <code>QSKIP(message)</code> in C++.</p>
</div></div><!-- @@@skip -->
<br/>
<!-- $$$sleep -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="sleep-method"><td class="tblQmlFuncNode"><p><a name="sleep-method"></a><span class="name">sleep</span>(<i> ms</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Sleeps for <i>ms</i> milliseconds without processing Qt events.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#wait-method">wait()</a> and <a href="qml-qttest-testcase.html#waitForRendering-method">waitForRendering()</a>.</p>
</div></div><!-- @@@sleep -->
<br/>
<!-- $$$tryCompare -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="tryCompare-method"><td class="tblQmlFuncNode"><p><a name="tryCompare-method"></a><span class="name">tryCompare</span>(<i> obj</i>, <i> property</i>, <i> expected</i>, <i> timeout</i> = 5000, <i> message</i> = &quot;&quot;)</p></td></tr></table></div></div><div class="qmldoc"><p>Fails the current test case if the specified <i>property</i> on <i>obj</i> is not the same as <i>expected</i>, and displays the optional <i>message</i>. The test will be retried multiple times until the <i>timeout</i> (in milliseconds) is reached.</p>
<p>This function is intended for testing applications where a property changes value based on asynchronous events. Use <a href="qml-qttest-testcase.html#compare-method">compare()</a> for testing synchronous property changes.</p>
<pre class="cpp">tryCompare(img<span class="operator">,</span> <span class="string">&quot;status&quot;</span><span class="operator">,</span> BorderImage<span class="operator">.</span>Ready)
<a href="qml-qttest-testcase.html#compare-method">compare</a>(img<span class="operator">.</span>width<span class="operator">,</span> <span class="number">120</span>)
<a href="qml-qttest-testcase.html#compare-method">compare</a>(img<span class="operator">.</span>height<span class="operator">,</span> <span class="number">120</span>)
<a href="qml-qttest-testcase.html#compare-method">compare</a>(img<span class="operator">.</span>horizontalTileMode<span class="operator">,</span> BorderImage<span class="operator">.</span>Stretch)
<a href="qml-qttest-testcase.html#compare-method">compare</a>(img<span class="operator">.</span>verticalTileMode<span class="operator">,</span> BorderImage<span class="operator">.</span>Stretch)</pre>
<p><a href="qml-qttest-signalspy.html#wait-method">SignalSpy::wait()</a> provides an alternative method to wait for a signal to be emitted.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#compare-method">compare()</a> and <a href="qml-qttest-signalspy.html#wait-method">SignalSpy::wait()</a>.</p>
</div></div><!-- @@@tryCompare -->
<br/>
<!-- $$$verify -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="verify-method"><td class="tblQmlFuncNode"><p><a name="verify-method"></a><span class="name">verify</span>(<i> condition</i>, <i> message</i> = &quot;&quot;)</p></td></tr></table></div></div><div class="qmldoc"><p>Fails the current test case if <i>condition</i> is false, and displays the optional <i>message</i>. Similar to <code>QVERIFY(condition)</code> or <code>QVERIFY2(condition, message)</code> in C++.</p>
</div></div><!-- @@@verify -->
<br/>
<!-- $$$wait -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="wait-method"><td class="tblQmlFuncNode"><p><a name="wait-method"></a><span class="name">wait</span>(<i> ms</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Waits for <i>ms</i> milliseconds while processing Qt events.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#sleep-method">sleep()</a> and <a href="qml-qttest-testcase.html#waitForRendering-method">waitForRendering()</a>.</p>
</div></div><!-- @@@wait -->
<br/>
<!-- $$$waitForRendering -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="waitForRendering-method"><td class="tblQmlFuncNode"><p><a name="waitForRendering-method"></a><span class="name">waitForRendering</span>(<i> item</i>, <i> timeout</i> = 5000)</p></td></tr></table></div></div><div class="qmldoc"><p>Waits for <i>timeout</i> milliseconds or until the <i>item</i> is rendered by the renderer. Returns true if <code>item</code> is rendered in <i>timeout</i> milliseconds, otherwise returns false. The default <i>timeout</i> value is 5000.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#sleep-method">sleep()</a> and <a href="qml-qttest-testcase.html#wait-method">wait()</a>.</p>
</div></div><!-- @@@waitForRendering -->
<br/>
<!-- $$$warn -->
<div class="qmlitem"><div class="qmlproto"><div class="table"><table class="qmlname"><tr valign="top" class="odd" id="warn-method"><td class="tblQmlFuncNode"><p><a name="warn-method"></a><span class="name">warn</span>(<i> message</i>)</p></td></tr></table></div></div><div class="qmldoc"><p>Prints <i>message</i> as a warning message. Similar to <code>QWARN(message)</code> in C++.</p>
<p><b>See also </b><a href="qml-qttest-testcase.html#ignoreWarning-method">ignoreWarning()</a>.</p>
</div></div><!-- @@@warn -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2015 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>