summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeGUI/CMakeGUITest.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-09-24 21:20:10 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-09-28 13:46:35 (GMT)
commit85f5009d2786349a6576d19bf6b605f825775b44 (patch)
tree355e8130c4be0d6135a26dca355ac22b40316115 /Tests/CMakeGUI/CMakeGUITest.cxx
parentd6c051c126a8cba8adec39b6ae3ae09cc773633f (diff)
downloadCMake-85f5009d2786349a6576d19bf6b605f825775b44.zip
CMake-85f5009d2786349a6576d19bf6b605f825775b44.tar.gz
CMake-85f5009d2786349a6576d19bf6b605f825775b44.tar.bz2
CMake GUI: Add environment editor
Diffstat (limited to 'Tests/CMakeGUI/CMakeGUITest.cxx')
-rw-r--r--Tests/CMakeGUI/CMakeGUITest.cxx29
1 files changed, 29 insertions, 0 deletions
diff --git a/Tests/CMakeGUI/CMakeGUITest.cxx b/Tests/CMakeGUI/CMakeGUITest.cxx
index 4087d6b..80ea08d 100644
--- a/Tests/CMakeGUI/CMakeGUITest.cxx
+++ b/Tests/CMakeGUI/CMakeGUITest.cxx
@@ -143,6 +143,35 @@ void CMakeGUITest::simpleConfigure_data()
<< -1;
}
+void CMakeGUITest::environment()
+{
+ auto* cmake = this->m_window->findChild<QCMakeThread*>()->cmakeInstance();
+
+ this->m_window->SourceDirectory->setText(CMakeGUITest_BINARY_DIR
+ "/environment/src");
+ this->m_window->BinaryDirectory->setCurrentText(CMakeGUITest_BINARY_DIR
+ "/environment/build");
+
+ // We are already testing EnvironmentDialog, so just trust that it's
+ // connected correctly and modify the environment directly.
+ auto env = cmake->environment();
+ env.insert("ADDED_VARIABLE", "Added variable");
+ env.insert("CHANGED_VARIABLE", "Changed variable");
+ env.remove("REMOVED_VARIABLE");
+ cmake->setEnvironment(env);
+
+ // Wait a bit for everything to update
+ loopSleep();
+
+ this->tryConfigure();
+
+ auto penv = QProcessEnvironment::systemEnvironment();
+ QVERIFY(!penv.contains("ADDED_VARIABLE"));
+ QCOMPARE(penv.value("KEPT_VARIABLE"), "Kept variable");
+ QCOMPARE(penv.value("CHANGED_VARIABLE"), "This variable will be changed");
+ QCOMPARE(penv.value("REMOVED_VARIABLE"), "Removed variable");
+}
+
void SetupDefaultQSettings()
{
QSettings::setDefaultFormat(QSettings::IniFormat);