Skip to content

Commit

Permalink
Move editor tools into editors folder (#4324)
Browse files Browse the repository at this point in the history
Move editor tools into editors folder and add test QtCreator template
  • Loading branch information
NathanW2 committed Apr 4, 2017
1 parent ae59e35 commit f23ed3a
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions editors/QtCreator/templates/wizards/qgis/qgis_icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions editors/QtCreator/templates/wizards/qgis/qgis_test/file.cpp
@@ -0,0 +1,41 @@
% {Cpp: LicenseTemplate}\
#include "qgstest.h"
#include <QObject>
#include <qgsapplication.h>

class % {CN}: public QObject
{

Q_OBJECT

private slots:
void initTestCase(); // will be called before the first testfunction is executed.
void cleanupTestCase() {} // will be called after the last testfunction was executed.
void init() {} // will be called before each testfunction is executed.
void cleanup() {} // will be called after every testfunction.

// Add your test methods here
};

void % {CN}::initTestCase()
{

}

void % {CN}::cleanupTestCase()
{

}

void % {CN}::init()
{

}

void % {CN}::cleanup()
{

}

QGSTEST_MAIN( % {CN} )
#include "%{JS: Cpp.classToFileName('%{Class}', '.moc')}"
86 changes: 86 additions & 0 deletions editors/QtCreator/templates/wizards/qgis/qgis_test/wizard.json
@@ -0,0 +1,86 @@
{
"version": 1,
"supportedProjectTypes": [ ],
"id": "B.QGISTest",
"category": "O.QGIS",
"trDescription": "Creates a C++ QGIS Test",
"trDisplayName": "QGIS C++ Test",
"trDisplayCategory": "QGIS",
"icon": "../qgis_icon.svg",
"enabled": "%{JS: [ %{Plugins} ].indexOf('CppEditor') >= 0}",
"platformIndependent" : true,

"options":
[
{ "key": "TargetPath", "value": "Test%{Path}" },
{ "key": "SrcPath", "value": "%{Path}/%{SrcFileName}" },
{ "key": "CN", "value": "%{JS: Cpp.className('%{Class}')}" }
],

"pages":
[
{
"trDisplayName": "Define Tests",
"trShortTitle": "Details",
"typeId": "Fields",
"data" :
[
{
"name": "Class",
"trDisplayName": "Class name:",
"mandatory": true,
"type": "LineEdit",
"data": { "validator": "(?:(?:[a-zA-Z_][a-zA-Z_0-9]*::)*[a-zA-Z_][a-zA-Z_0-9]*|)" }
},
{
"name": "Sp1",
"type": "Spacer",
"data": { "factor": 2 }
},
{
"name": "SrcFileName",
"type": "LineEdit",
"trDisplayName": "Source file:",
"mandatory": true,
"data": { "trText": "%{JS: Cpp.classToFileName('%{Class}', '%{JS: Util.preferredSuffix('text/x-c++src')}')}" }
},
{
"name": "Path",
"type": "PathChooser",
"trDisplayName": "Path:",
"mandatory": true,
"data":
{
"kind": "existingDirectory",
"basePath": "%{CurrentProject:Path}\\tests\\src\\",
"path": "%{CurrentProject:Path}\\tests\\src\\"
}
}
]
},
{
"trDisplayName": "Project Management",
"trShortTitle": "Summary",
"typeId": "Summary"
}
],

"generators":
[
{
"typeId": "File",
"data":
[
{
"source": "file.cpp",
"target": "%{SrcPath}",
"openInEditor": true,
"options": [
{ "key": "Cpp:License:FileName", "value": "%{SrcFileName}" },
{ "key": "Cpp:License:ClassName", "value": "%{CN}" }
]
}
]
}
]
}

0 comments on commit f23ed3a

Please sign in to comment.