Changeset View
Changeset View
Standalone View
Standalone View
file_templates/testing/cpp_qtestlib_kdevelop/class.cpp
1 | {% load kdev_filters %} | 1 | {% load kdev_filters %} | ||
---|---|---|---|---|---|
2 | {% include "license_header_cpp.txt" %} | 2 | {% include "license_header_cpp.txt" %} | ||
3 | 3 | | |||
4 | 4 | | |||
5 | #include "{{ output_file_header }}" | 5 | #include "{{ output_file_header }}" | ||
6 | 6 | | |||
7 | 7 | | |||
8 | #include <tests/testcore.h> | 8 | #include <tests/testcore.h> | ||
9 | #include <tests/autotestshell.h> | 9 | #include <tests/autotestshell.h> | ||
10 | 10 | | |||
11 | 11 | | |||
12 | QTEST_GUILESS_MAIN({{ name }}); | 12 | QTEST_{% if test_nogui %}GUILESS_{% endif %}MAIN({{ name }}); | ||
13 | 13 | | |||
14 | 14 | | |||
15 | using namespace KDevelop; | 15 | using namespace KDevelop; | ||
16 | 16 | | |||
17 | 17 | | |||
18 | void {{ name }}::initTestCase() | 18 | void {{ name }}::initTestCase() | ||
19 | { | 19 | { | ||
20 | AutoTestShell::init(); | 20 | AutoTestShell::init(); | ||
21 | TestCore::initialize(Core::NoUi); | 21 | TestCore::initialize(Core::{% if test_nogui %}NoUi{% else %}Default{% endif %}); | ||
22 | } | 22 | } | ||
23 | 23 | | |||
24 | 24 | | |||
25 | void {{ name }}::cleanupTestCase() | 25 | void {{ name }}::cleanupTestCase() | ||
26 | { | 26 | { | ||
27 | TestCore::shutdown(); | 27 | TestCore::shutdown(); | ||
28 | } | 28 | } | ||
29 | 29 | | |||
30 | 30 | | |||
31 | {% if test_initAndCleanup %} | ||||
32 | void {{name}}::init() | ||||
33 | { | ||||
34 | // Called before each testfunction is executed | ||||
35 | } | ||||
36 | | ||||
37 | | ||||
38 | void {{name}}::cleanup() | ||||
39 | { | ||||
40 | // Called after every testfunction | ||||
41 | } | ||||
42 | | ||||
43 | | ||||
44 | {% endif %} | ||||
31 | {% for case in testCases %} | 45 | {% for case in testCases %} | ||
32 | 46 | | |||
33 | void {{ name }}::{{ case }}() | 47 | void {{ name }}::{% if test_prefixMethods %}test{{ case|upper_first }}{% else %}{{ case }}{% endif %}() | ||
34 | { | 48 | { | ||
35 | 49 | | |||
36 | 50 | | |||
37 | } | 51 | } | ||
38 | 52 | | |||
39 | {% endfor %} | 53 | {% endfor %} |