{
    "version": 1,
    "supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
    "id": "R.AutoTest",
    "category": "H.Project",
    "trDescription": "Creates a new unit test project. Unit tests allow you to verify that the code is fit for use and that there are no regressions.",
    "trDisplayName": "Auto Test Project",
    "trDisplayCategory": "Other Project",
    "icon": "autotest.png",
    "featuresRequired": [ "QtSupport.Wizards.FeatureQt", "QtSupport.Wizards.FeatureDesktop" ],
    "enabled": "%{JS: [ %{Plugins} ].indexOf('AutoTest') >= 0}",

    "options":
    [
        { "key": "ProjectFilePath",
          "value": "%{JS: '%{BuildSystem}' == 'qmake' ? '%{ProFileName}' : ('%{BuildSystem}' == 'qbs' ? '%{QbsFileName}' : '%{CMakeFileName}') }"
        },
        { "key": "ProFileName",
          "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}"
        },
        {
          "key": "QbsFileName",
          "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'qbs')}"
        },
        {
          "key": "CMakeFileName",
          "value": "%{ProjectDirectory}/CMakeLists.txt"
        },
        { "key": "IsTopLevelProject",
           "value": "%{JS: !'%{Exists:ProjectExplorer.Profile.Ids}' }"
        },
        { "key": "MainCppName",
          "value": "%{JS: 'main.' + Util.preferredSuffix('text/x-c++src') }"
        },
        {
          "key": "TestCaseFileWithHeaderSuffix",
          "value": "%{JS: 'tst_%{TestCaseName}.'.toLowerCase() + Util.preferredSuffix('text/x-c++hdr') }"
        },
        {
          "key": "TestCaseFileWithCppSuffix",
          "value": "%{JS: 'tst_%{TestCaseName}.'.toLowerCase() + Util.preferredSuffix('text/x-c++src') }"
        }
    ],

    "pages":
    [
        {
            "trDisplayName": "Project Location",
            "trShortTitle": "Location",
            "typeId": "Project",
            "data":
            {
                "trDescription": "This wizard creates a simple unit test project."
            }
        },
        {
            "trDisplayName": "Project and Test Information",
            "trShortTitle": "Details",
            "typeId": "Fields",
            "data":
            [
                {
                    "name": "TestFrameWork",
                    "trDisplayName": "Test framework:",
                    "type": "ComboBox",
                    "data":
                    {
                        "index": 0,
                        "items":
                        [
                            {
                                "trKey": "Qt Test",
                                "value": "QtTest"
                            },
                            {
                                "trKey": "Googletest",
                                "value": "GTest"
                            }
                        ]
                    }
                },
                {
                    "name": "RequireGUI",
                    "trDisplayName": "GUI Application",
                    "visible": "%{JS: '%{TestFrameWork}' === 'QtTest'}",
                    "type": "CheckBox",
                    "data": {
                        "checked": false,
                        "checkedValue": "true",
                        "uncheckedValue": "false"
                    }
                },
                {
                    "name": "TestCaseName",
                    "trDisplayName": "Test case name:",
                    "mandatory": true,
                    "type": "LineEdit",
                    "data": { "validator": "^[a-zA-Z_0-9]+$" }
                },
                {
                    "name": "RequireApplication",
                    "trDisplayName": "Requires QApplication",
                    "visible": "%{JS: '%{TestFrameWork}' === 'QtTest'}",
                    "type": "CheckBox",
                    "data": {
                        "checked": false,
                        "checkedValue": "true",
                        "uncheckedValue": "false"
                    }
                },
                {
                    "name": "GenerateInitAndCleanup",
                    "trDisplayName": "Generate initialization and cleanup code",
                    "visible": "%{JS: '%{TestFrameWork}' === 'QtTest'}",
                    "type": "CheckBox",
                    "data": {
                        "checked": false,
                        "checkedValue": "true",
                        "uncheckedValue": "false"
                    }
                },
                {
                    "name": "TestSetName",
                    "trDisplayName": "Test set name:",
                    "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}",
                    "type": "LineEdit",
                    "data": { "validator": "^[a-zA-Z0-9]+$" }
                },
                {
                    "name": "GTestCXX11",
                    "trDisplayName": "Enable C++11",
                    "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}",
                    "type": "CheckBox",
                    "data": {
                        "checked": false,
                        "checkedValue": "true",
                        "uncheckedValue": "false"
                    }
                },
                {
                    "name": "GTestRepository",
                    "trDisplayName": "Googletest repository:",
                    "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}",
                    "type": "PathChooser",
                    "data": {
                        "kind": "existingDirectory"
                    }
                },
                {
                    "name": "BuildSystem",
                    "trDisplayName": "Build system:",
                    "type": "ComboBox",
                    "data":
                    {
                        "index": 0,
                        "items":
                        [
                            {
                                "trKey": "qmake",
                                "value": "qmake"
                            },
                            {
                                "trKey": "Qbs",
                                "value": "qbs",
                                "condition": "%{JS: [ %{Plugins} ].indexOf('QbsProjectManager') >= 0}"
                            },
                            {
                                "trKey": "CMake",
                                "value": "cmake",
                                "condition": "%{JS: [ %{Plugins} ].indexOf('CMakeProjectManager') >= 0}"
                            }
                        ]
                    }
                }
            ]
        },
        {
            "trDisplayName": "Kit Selection",
            "trShortTitle": "Kits",
            "typeId": "Kits",
            "enabled": "%{IsTopLevelProject}",
            "data": {
                 "projectFilePath": "%{ProjectFilePath}",
                 "requiredFeatures": [ "%{JS: ('%{BuildSystem}' == 'cmake' && '%{TestFrameWork}' == 'QtTest') ? 'QtSupport.Wizards.FeatureQt.5' : 'QtSupport.Wizards.FeatureQt' }" ]
            }
        },
        {
            "trDisplayName": "Project Management",
            "trShortTitle": "Summary",
            "typeId": "Summary"
        }
    ],
    "generators":
    [
        {
            "typeId": "File",
            "data":
            [
                {
                    "source": "files/gtest_dependency.pri",
                    "target": "gtest_dependency.pri",
                    "condition": "%{JS: '%{TestFrameWork}' == 'GTest' && '%{BuildSystem}' == 'qmake'}",
                    "openInEditor": false
                },
                {
                    "source": "files/googlecommon.js",
                    "target": "googlecommon.js",
                    "condition": "%{JS: '%{TestFrameWork}' == 'GTest' && '%{BuildSystem}' == 'qbs'}",
                    "openInEditor": false
                },
                {
                    "source": "files/tst.pro",
                    "target": "%{ProjectFilePath}",
                    "condition": "%{JS: '%{BuildSystem}' == 'qmake'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "files/tst.qbs",
                    "target": "%{ProjectFilePath}",
                    "condition": "%{JS: '%{BuildSystem}' == 'qbs'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "files/tst.txt",
                    "target": "CMakeLists.txt",
                    "condition": "%{JS: '%{BuildSystem}' == 'cmake'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "files/tst_src.h",
                    "target": "%{TestCaseFileWithHeaderSuffix}",
                    "condition": "%{JS: '%{TestFrameWork}' == 'GTest'}",
                    "openInEditor": true
                },
                {
                    "source": "files/tst_src.cpp",
                    "target": "%{TestCaseFileWithCppSuffix}",
                    "condition": "%{JS: '%{TestFrameWork}' == 'QtTest'}",
                    "openInEditor": true
                },
                {
                    "source": "files/tst_main.cpp",
                    "target": "%{MainCppName}",
                    "condition": "%{JS: '%{TestFrameWork}' == 'GTest'}",
                    "openInEditor": true
                },
                {
                    "source": "../projects/git.ignore",
                    "target": ".gitignore",
                    "condition": "%{JS: ( %{IsTopLevelProject} && '%{VersionControl}' === 'G.Git' )}"
                }
            ]
        }
    ]
}
