MCPcopy Create free account
hub / github.com/Kitware/CMake / environmentDialog

Method environmentDialog

Tests/CMakeGUI/EnvironmentDialogTest.cxx:20–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20void EnvironmentDialogTest::environmentDialog()
21{
22 CatchShow catcher;
23 catcher.setCallback<QMessageBox>([](QMessageBox* box) { box->accept(); });
24
25 QProcessEnvironment env;
26 env.insert("DELETED_VARIABLE_1", "Deleted variable 1");
27 env.insert("DELETED_VARIABLE_2", "Deleted variable 2");
28 env.insert("KEPT_VARIABLE", "Kept variable");
29 env.insert("CHANGED_VARIABLE", "This will be changed");
30
31 EnvironmentDialog dialog(env);
32
33 {
34 QStringList expected{
35 "CHANGED_VARIABLE=This will be changed",
36 "DELETED_VARIABLE_1=Deleted variable 1",
37 "DELETED_VARIABLE_2=Deleted variable 2",
38 "KEPT_VARIABLE=Kept variable",
39 };
40 QCOMPARE(dialog.environment().toStringList(), expected);
41 QCOMPARE(catcher.count(), 0);
42 }
43
44 {
45 CatchShow catcher2;
46 bool done = false;
47 catcher2.setCallback<QDialog>([&catcher, &done](QDialog* box) {
48 if (done) {
49 return;
50 }
51 done = true;
52
53 auto name = box->findChild<QLineEdit*>("name");
54 auto value = box->findChild<QLineEdit*>("value");
55 auto acceptReject = box->findChild<QDialogButtonBox*>();
56
57 name->setText("");
58 value->setText("");
59 acceptReject->button(QDialogButtonBox::Ok)->click();
60 QCOMPARE(catcher.count(), 1);
61
62 name->setText("KEPT_VARIABLE");
63 value->setText("");
64 acceptReject->button(QDialogButtonBox::Ok)->click();
65 QCOMPARE(catcher.count(), 2);
66
67 name->setText("ADDED_VARIABLE");
68 value->setText("Added variable");
69 acceptReject->button(QDialogButtonBox::Ok)->click();
70 QCOMPARE(catcher.count(), 2);
71 });
72 dialog.AddEntry->click();
73
74 QStringList expected{
75 "ADDED_VARIABLE=Added variable",
76 "CHANGED_VARIABLE=This will be changed",
77 "DELETED_VARIABLE_1=Deleted variable 1",

Callers

nothing calls this directly

Calls 8

acceptMethod · 0.80
rowCountMethod · 0.80
buddyMethod · 0.80
insertMethod · 0.45
environmentMethod · 0.45
countMethod · 0.45
indexMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected