diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-12-10 14:37:53 +1000 |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-12-10 14:41:53 +1000 |
commit | 8e8357ffe9099b16a51e9dc8ef8649fbde27c53f (patch) | |
tree | 56ab7570f97df1833f31e328cbb7565442e827dc /src | |
parent | 03da52a7e19759654bfc16c64ac87193a0e4a32d (diff) |
Convert the documentation into qdoc form
Use "make docs" to generate the documentation under "doc/html".
Diffstat (limited to 'src')
-rw-r--r-- | src/imports/testlib/testcase.qdoc | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/src/imports/testlib/testcase.qdoc b/src/imports/testlib/testcase.qdoc index 83faae0..5805467 100644 --- a/src/imports/testlib/testcase.qdoc +++ b/src/imports/testlib/testcase.qdoc @@ -90,6 +90,10 @@ 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. + Multiple TestCase elements 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 \l optional can be set to true. + \section1 Data-driven tests Table data can be provided to a test using a function name that ends @@ -168,13 +172,31 @@ \qmlproperty bool TestCase::when This property should be set to true when the application wants - the test cases to run. The default value is true. + 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: \code - TestCase { - name: "ButtonTests" - when: button.pressed - ... + Rectangle { + id: foo + width: 640; height: 480 + color: "cyan" + + MouseArea { + id: area + anchors.fill: parent + } + + property bool bar: true + + TestCase { + name: "ItemTests" + when: area.pressed + id: test1 + + function test_bar() { + verify(bar) + } + } } \endcode @@ -291,6 +313,14 @@ changes value based on asynchronous events. Use compare() for testing synchronous property changes. + \code + tryCompare(img, "status", BorderImage.Ready) + compare(img.width, 120) + compare(img.height, 120) + compare(img.horizontalTileMode, BorderImage.Stretch) + compare(img.verticalTileMode, BorderImage.Stretch) + \endcode + \sa compare() */ |