From 566754014bb2c0ad2667b05ad9a2965d7a173d9d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 3 Nov 2023 13:08:59 +0100 Subject: [PATCH] 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 --- src/plugins/autotest/gtest/gtestframework.cpp | 10 ++++++++-- src/plugins/autotest/gtest/gtestframework.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/autotest/gtest/gtestframework.cpp b/src/plugins/autotest/gtest/gtestframework.cpp index 8e54e1d7255..191ffc82c29 100644 --- a/src/plugins/autotest/gtest/gtestframework.cpp +++ b/src/plugins/autotest/gtest/gtestframework.cpp @@ -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(); diff --git a/src/plugins/autotest/gtest/gtestframework.h b/src/plugins/autotest/gtest/gtestframework.h index ff9e2766b58..80052980b1d 100644 --- a/src/plugins/autotest/gtest/gtestframework.h +++ b/src/plugins/autotest/gtest/gtestframework.h @@ -32,6 +32,8 @@ public: QString groupingToolTip() const override; ITestParser *createTestParser() override; ITestTreeItem *createRootNode() override; + + void readSettings() final; }; GTestFramework &theGTestFramework();