MCPcopy Create free account
hub / github.com/KDE/kdevelop / testVariablesChanged

Method testVariablesChanged

plugins/debuggercommon/tests/debuggertestbase.cpp:2077–2182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2075}
2076
2077void DebuggerTestBase::testVariablesChanged()
2078{
2079 // kdevlldb xfails the test because of a workaround in LLDB::DebugSession::updateAllVariables()
2080 // that updates all variables manually and never marks variables as changed.
2081
2082 auto* const session = createTestDebugSession();
2083 TestLaunchConfiguration cfg;
2084
2085 const auto* const variableController = session->variableController();
2086 QVERIFY(variableController);
2087
2088 auto* const collection = variableCollection();
2089
2090 QCOMPARE(variableController->autoUpdate(), IVariableController::UpdateNone);
2091 collection->variableWidgetShown();
2092 // The "Auto" collection is initially expanded.
2093 QCOMPARE(variableController->autoUpdate(), IVariableController::UpdateWatches);
2094
2095 auto* const breakpoint = addDebugeeBreakpoint(23);
2096 ActiveStateSessionSpy sessionSpy(session);
2097 START_DEBUGGING_AND_WAIT_FOR_PAUSED_STATE_E(session, cfg, sessionSpy);
2098 QCOMPARE(currentMiLine(session), 23);
2099
2100 // Prepare "static int i = 0;"
2101 // In LLDB, "i" doesn't exist in Locals, so we have to do this via a watch.
2102 const auto* const iVariable = collection->watches()->add("i");
2103 QVERIFY(iVariable);
2104
2105 // Expand the Locals collection.
2106 const auto localsIndex = collection->index(1, 0);
2107 COMPARE_DATA(localsIndex, VariableCollection::defaultLocalsSectionTitle());
2108 QCOMPARE(variableController->autoUpdate(), IVariableController::UpdateWatches);
2109 collection->expanded(localsIndex);
2110 QCOMPARE(variableController->autoUpdate(), IVariableController::UpdateLocals | IVariableController::UpdateWatches);
2111
2112 // Wait for the watch to be added and the collections to be expanded.
2113 WAIT_FOR_STATE_AND_IDLE(session, IDebugSession::PausedState);
2114 const auto watchesIndex = collection->index(0, 0);
2115 COMPARE_DATA(watchesIndex, Watches::sectionTitle());
2116 QCOMPARE(collection->rowCount(watchesIndex), 1);
2117
2118 QCOMPARE(iVariable->value(), "0");
2119 // Top-level variables are initialized as unchanged.
2120 QCOMPARE(iVariable->isChanged(), false);
2121
2122 STEP_OVER_AND_WAIT_FOR_PAUSED_STATE(session, sessionSpy);
2123 QCOMPARE(currentMiLine(session), 24);
2124
2125 QCOMPARE(iVariable->value(), "1");
2126 if (isLldb()) {
2127 QEXPECT_FAIL("", "kdevlldb does not properly support reporting isChanged()", Continue);
2128 }
2129 QCOMPARE(iVariable->isChanged(), true);
2130
2131 STEP_OVER_AND_WAIT_FOR_PAUSED_STATE(session, sessionSpy);
2132 QCOMPARE(currentMiLine(session), 25);
2133
2134 QCOMPARE(iVariable->value(), "1");

Callers

nothing calls this directly

Calls 15

variableCollectionFunction · 0.85
currentMiLineFunction · 0.85
autoUpdateMethod · 0.80
variableWidgetShownMethod · 0.80
variableControllerMethod · 0.45
addMethod · 0.45
indexMethod · 0.45
expandedMethod · 0.45
rowCountMethod · 0.45
valueMethod · 0.45
itemForIndexMethod · 0.45
setLineMethod · 0.45

Tested by

no test coverage detected