{
    "version": 1,
    "supportedProjectTypes": [ "Qt4ProjectManager.Qt4Project" ],
    "id": "R.AutoTest",
    "category": "H.Project",
    "trDescription": "Creates a new project including an auto test skeleton.",
    "trDisplayName": "Auto Test Project",
    "trDisplayCategory": "Other Project",
    "icon": "autotest_24.png",
    "featuresRequired": [ "QtSupport.Wizards.FeatureQt", "QtSupport.Wizards.FeatureDesktop" ],
    "enabled": "%{JS: [ %{Plugins} ].indexOf('AutoTest') >= 0}",

    "options":
    [
        { "key": "ProFileName",
          "value": "%{JS: Util.fileName('%{ProjectDirectory}/%{ProjectName}', 'pro')}"
        },
        { "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 Qmake based project with an additional auto test skeleton."
            }
        },
        {
            "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": "BuildAutoTests",
                    "trDisplayName": "Build auto tests",
                    "type": "ComboBox",
                    "data":
                    {
                        "index": 0,
                        "items":
                        [
                            {
                                "trKey": "always",
                                "value": "always"
                            },
                            {
                                "trKey": "debug only",
                                "value": "debug"
                            }
                        ]
                    }
                },
                {
                    "name": "GTestRepository",
                    "trDisplayName": "Googletest repository:",
                    "visible": "%{JS: '%{TestFrameWork}' === 'GTest'}",
                    "type": "PathChooser",
                    "data": {
                        "kind": "existingDirectory"
                    }
                }
            ]
        },
        {
            "trDisplayName": "Kit Selection",
            "trShortTitle": "Kits",
            "typeId": "Kits",
            "enabled": "%{IsTopLevelProject}",
            "data": { "projectFilePath": "%{ProFileName}" }
        },
        {
            "trDisplayName": "Project Management",
            "trShortTitle": "Summary",
            "typeId": "Summary"
        }
    ],
    "generators":
    [
        {
            "typeId": "File",
            "data":
            [
                {
                    "source": "files/tmp.pro",
                    "target": "%{ProFileName}",
                    "openAsProject": true
                },
                {
                    "source": "files/src.pro",
                    "target": "src/src.pro",
                    "openInEditor": false
                },
                {
                    "source": "files/main.cpp",
                    "target": "src/%{MainCppName}",
                    "openInEditor": true
                },
                {
                    "source": "files/tests.pro",
                    "target": "tests/tests.pro",
                    "openInEditor": false
                },
                {
                    "source": "files/auto.pro",
                    "target": "tests/auto/auto.pro",
                    "openInEditor": false
                },
                {
                    "source": "files/gtest_dependency.pri",
                    "target": "tests/auto/gtest_dependency.pri",
                    "condition": "%{JS: '%{TestFrameWork}' == 'GTest'}",
                    "openInEditor": false
                },
                {
                    "source": "files/tst.pro",
                    "target": "%{JS: 'tests/auto/' + '%{TestCaseName}/%{TestCaseName}'.toLowerCase() + '.pro' }",
                    "openInEditor": false
                },
                {
                    "source": "files/tst_src.h",
                    "target": "%{JS: 'tests/auto/' + '%{TestCaseName}/'.toLowerCase() + '%{TestCaseFileWithHeaderSuffix}' }",
                    "condition": "%{JS: '%{TestFrameWork}' == 'GTest'}",
                    "openInEditor": true
                },
                {
                    "source": "files/tst_src.cpp",
                    "target": "%{JS: 'tests/auto/' + '%{TestCaseName}/'.toLowerCase() + '%{TestCaseFileWithCppSuffix}' }",
                    "condition": "%{JS: '%{TestFrameWork}' == 'QtTest'}",
                    "openInEditor": true
                },
                {
                    "source": "files/tst_main.cpp",
                    "target": "%{JS: 'tests/auto/' + '%{TestCaseName}'.toLowerCase() + '/%{MainCppName}' }",
                    "condition": "%{JS: '%{TestFrameWork}' == 'GTest'}",
                    "openInEditor": true
                },
                {
                    "source": "../projects/git.ignore",
                    "target": ".gitignore",
                    "condition": "%{JS: ( %{IsTopLevelProject} && '%{VersionControl}' === 'G.Git' )}"
                }
            ]
        }
    ]
}
