forked from qt-creator/qt-creator
AutoTest: Fix handling of gtest settings
Fixes the initial value of the group mode as well as storing and retrieving the values. Also correctly updates the enabled state of the filter. Change-Id: I083b783a60729cae795f0aaf1638da499737f545 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -95,14 +95,14 @@ GTestFramework::GTestFramework()
|
||||
// avoid problems if user messes around with the settings file
|
||||
bool ok = false;
|
||||
const int tmp = savedValue.toInt(&ok);
|
||||
return ok ? groupMode.indexForItemValue(tmp) : GTest::Constants::Directory;
|
||||
return groupMode.indexForItemValue(ok ? tmp : GTest::Constants::Directory);
|
||||
});
|
||||
groupMode.setToSettingsTransformation([this](const QVariant &value) {
|
||||
return groupMode.itemValueForIndex(value.toInt());
|
||||
});
|
||||
groupMode.addOption({Tr::tr("Directory"), {}, GTest::Constants::Directory});
|
||||
groupMode.addOption({Tr::tr("GTest Filter"), {}, GTest::Constants::GTestFilter});
|
||||
groupMode.setDefaultValue(GTest::Constants::Directory);
|
||||
groupMode.setDefaultValue(groupMode.indexForItemValue(GTest::Constants::Directory));
|
||||
groupMode.setLabelText(Tr::tr("Group mode:"));
|
||||
groupMode.setToolTip(Tr::tr("Select on what grouping the tests should be based."));
|
||||
|
||||
@@ -144,6 +144,12 @@ ITestTreeItem *GTestFramework::createRootNode()
|
||||
return new GTestTreeItem(this, displayName(), {}, ITestTreeItem::Root);
|
||||
}
|
||||
|
||||
void GTestFramework::readSettings()
|
||||
{
|
||||
Utils::AspectContainer::readSettings();
|
||||
gtestFilter.setEnabled(groupMode.itemValue() == GTest::Constants::GTestFilter);
|
||||
}
|
||||
|
||||
QString GTestFramework::currentGTestFilter()
|
||||
{
|
||||
return theGTestFramework().gtestFilter();
|
||||
|
@@ -32,6 +32,8 @@ public:
|
||||
QString groupingToolTip() const override;
|
||||
ITestParser *createTestParser() override;
|
||||
ITestTreeItem *createRootNode() override;
|
||||
|
||||
void readSettings() final;
|
||||
};
|
||||
|
||||
GTestFramework &theGTestFramework();
|
||||
|
Reference in New Issue
Block a user