Skip to content

Commit f23ed3a

Browse files
authoredApr 4, 2017
Move editor tools into editors folder (#4324)
Move editor tools into editors folder and add test QtCreator template
1 parent ae59e35 commit f23ed3a

File tree

5 files changed

+152
-0
lines changed

5 files changed

+152
-0
lines changed
 
Lines changed: 25 additions & 0 deletions
Loading
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
% {Cpp: LicenseTemplate}\
2+
#include "qgstest.h"
3+
#include <QObject>
4+
#include <qgsapplication.h>
5+
6+
class % {CN}: public QObject
7+
{
8+
9+
Q_OBJECT
10+
11+
private slots:
12+
void initTestCase(); // will be called before the first testfunction is executed.
13+
void cleanupTestCase() {} // will be called after the last testfunction was executed.
14+
void init() {} // will be called before each testfunction is executed.
15+
void cleanup() {} // will be called after every testfunction.
16+
17+
// Add your test methods here
18+
};
19+
20+
void % {CN}::initTestCase()
21+
{
22+
23+
}
24+
25+
void % {CN}::cleanupTestCase()
26+
{
27+
28+
}
29+
30+
void % {CN}::init()
31+
{
32+
33+
}
34+
35+
void % {CN}::cleanup()
36+
{
37+
38+
}
39+
40+
QGSTEST_MAIN( % {CN} )
41+
#include "%{JS: Cpp.classToFileName('%{Class}', '.moc')}"
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"version": 1,
3+
"supportedProjectTypes": [ ],
4+
"id": "B.QGISTest",
5+
"category": "O.QGIS",
6+
"trDescription": "Creates a C++ QGIS Test",
7+
"trDisplayName": "QGIS C++ Test",
8+
"trDisplayCategory": "QGIS",
9+
"icon": "../qgis_icon.svg",
10+
"enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}",
11+
"platformIndependent" : true,
12+
13+
"options":
14+
[
15+
{ "key": "TargetPath", "value": "Test%{Path}" },
16+
{ "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" },
17+
{ "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }
18+
],
19+
20+
"pages":
21+
[
22+
{
23+
"trDisplayName": "Define Tests",
24+
"trShortTitle": "Details",
25+
"typeId": "Fields",
26+
"data" :
27+
[
28+
{
29+
"name": "Class",
30+
"trDisplayName": "Class name:",
31+
"mandatory": true,
32+
"type": "LineEdit",
33+
"data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)" }
34+
},
35+
{
36+
"name": "Sp1",
37+
"type": "Spacer",
38+
"data": { "factor": 2 }
39+
},
40+
{
41+
"name": "SrcFileName",
42+
"type": "LineEdit",
43+
"trDisplayName": "Source file:",
44+
"mandatory": true,
45+
"data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" }
46+
},
47+
{
48+
"name": "Path",
49+
"type": "PathChooser",
50+
"trDisplayName": "Path:",
51+
"mandatory": true,
52+
"data":
53+
{
54+
"kind": "existingDirectory",
55+
"basePath": "%{CurrentProject:Path}\\tests\\src\\",
56+
"path": "%{CurrentProject:Path}\\tests\\src\\"
57+
}
58+
}
59+
]
60+
},
61+
{
62+
"trDisplayName": "Project Management",
63+
"trShortTitle": "Summary",
64+
"typeId": "Summary"
65+
}
66+
],
67+
68+
"generators":
69+
[
70+
{
71+
"typeId": "File",
72+
"data":
73+
[
74+
{
75+
"source": "file.cpp",
76+
"target": "%{SrcPath}",
77+
"openInEditor": true,
78+
"options": [
79+
{ "key": "Cpp:License:FileName", "value": "%{SrcFileName}" },
80+
{ "key": "Cpp:License:ClassName", "value": "%{CN}" }
81+
]
82+
}
83+
]
84+
}
85+
]
86+
}

0 commit comments

Comments
 (0)
Please sign in to comment.