{
    "version": 1,
    "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject", "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
    "id": "A.QtTestAutoTest",
    "category": "I.TestProject",
    "trDescription": "Creates a new unit test project using Qt Test. Unit tests allow you to verify that the code is fit for use and that there are no regressions.",
    "trDisplayName": "Qt Test Project",
    "trDisplayCategory": "Test Project",
    "icon": "../autotest.png",
    "iconKind": "Themed",
    "enabled": "%{JS: isPluginRunning('cppeditor')}",

    "options":
    [
        { "key": "TestFrameWork",
          "value": "QtTest"
        },
        { "key": "ProjectFilePath",
          "value": "%{JS: value('BuildSystem') == 'qmake' ? value('ProFileName') : (value('BuildSystem') == 'qbs' ? value('QbsFileName') : value('CMakeFileName')) }"
        },
        { "key": "ProFileName",
          "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'pro')}"
        },
        {
          "key": "QbsFileName",
          "value": "%{JS: Util.fileName(value('ProjectDirectory') + '/' + value('ProjectName'), 'qbs')}"
        },
        {
          "key": "CMakeFileName",
          "value": "%{ProjectDirectory}/CMakeLists.txt"
        },
        {
          "key": "GUARD",
          "value": "%{JS: value('TestCaseFileWithHeaderSuffix').toUpperCase().replace('.', '_') }"
        },
        {
          "key": "TestCaseFileWithCppSuffix",
          "value": "%{JS: 'tst_' + value('TestCaseName').toLowerCase() + '.' + Util.preferredSuffix('text/x-c++src') }"
        },
        {
            "key": "FeatureQt",
            "value": "QtSupport.Wizards.FeatureQt%{JS: value('BuildSystem') === 'cmake-qt6' ? '.6.5' : ''}"
        },
        {
            "key": "MinimumSupportedQtVersion",
            "value": "%{JS: value('BuildSystem') === 'cmake-qt6' ? '6.5' : '5.0' }"
        },
        {
            "key": "HasQSPSetup",
            "value": "%{JS: value('MinimumSupportedQtVersion') > '6.2' }"
        },
        {
            "key": "UsesAutoResourcePrefix",
            "value": "%{JS: value('MinimumSupportedQtVersion') > '6.4' }"
        }
    ],

    "pages":
    [
        {
            "trDisplayName": "Project Location",
            "trShortTitle": "Location",
            "typeId": "Project",
            "data":
            {
                "trDescription": "This wizard creates a simple unit test project using Qt Test."
            }
        },
        {
            "trDisplayName": "Project and Test Information",
            "trShortTitle": "Details",
            "typeId": "Fields",
            "data":
            [
                {
                    "name": "TestCaseName",
                    "trDisplayName": "Test case name:",
                    "mandatory": true,
                    "type": "LineEdit",
                    "data": { "validator": "^[a-zA-Z_0-9]+$" }
                },
                {
                    "name": "RequireApplication",
                    "trDisplayName": "Requires QApplication",
                    "type": "CheckBox",
                    "data": {
                        "checked": false
                    }
                },
                {
                    "name": "RequireGUI",
                    "trDisplayName": "GUI Application",
                    "type": "CheckBox",
                    "data": {
                        "checked": false
                    }
                },
                {
                    "name": "GenerateInitAndCleanup",
                    "trDisplayName": "Generate initialization and cleanup code",
                    "type": "CheckBox",
                    "data": {
                        "checked": false
                    }
                },
                {
                    "name": "BuildSystem",
                    "trDisplayName": "Build system:",
                    "type": "ComboBox",
                    "persistenceKey": "BuildSystemType",
                    "visible": "%{JS: !value('IsSubproject')}",
                    "data":
                    {
                        "index": 1,
                        "items":
                        [
                            {
                                "trKey": "qmake",
                                "value": "qmake",
                                "condition": "%{JS: isPluginRunning('qmakeprojectmanager')}"
                            },
                            {
                                "trKey": "CMake for Qt5 and Qt 6",
                                "value": "cmake",
                                "condition": "%{JS: isPluginRunning('cmakeprojectmanager')}"
                            },
                            {
                                "trKey": "CMake",
                                "value": "cmake-qt6",
                                "condition": "%{JS: isPluginRunning('cmakeprojectmanager')}"
                            },
                            {
                                "trKey": "Qbs",
                                "value": "qbs",
                                "condition": "%{JS: isPluginRunning('qbsprojectmanager')}"
                            }
                        ]
                    }
                }
            ]
        },
        {
            "trDisplayName": "Kit Selection",
            "trShortTitle": "Kits",
            "typeId": "Kits",
            "data": {
                 "projectFilePath": "%{ProjectFilePath}",
                 "requiredFeatures": [ "%{FeatureQt}", "DeviceType.Desktop" ]
            }
        },
        {
            "trDisplayName": "Project Management",
            "trShortTitle": "Summary",
            "typeId": "Summary"
        }
    ],
    "generators":
    [
        {
            "typeId": "File",
            "data":
            [
                {
                    "source": "../files/tst.pro",
                    "target": "%{ProjectFilePath}",
                    "condition": "%{JS: value('BuildSystem') == 'qmake'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "../files/tst.qbs",
                    "target": "%{ProjectFilePath}",
                    "condition": "%{JS: value('BuildSystem') == 'qbs'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "../files/tst.txt",
                    "target": "CMakeLists.txt",
                    "condition": "%{JS: value('BuildSystem') == 'cmake'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "../files/tstQt6.txt",
                    "target": "CMakeLists.txt",
                    "condition": "%{JS: value('BuildSystem') == 'cmake-qt6'}",
                    "openInEditor": false,
                    "openAsProject": true
                },
                {
                    "source": "../files/tst_src.cpp",
                    "target": "%{TestCaseFileWithCppSuffix}",
                    "openInEditor": true
                },
                {
                    "source": "../../projects/git.ignore",
                    "target": ".gitignore",
                    "condition": "%{JS: ( !value('IsSubproject') && value('VersionControl') === 'G.Git' )}"
                }
            ]
        }
    ]
}
