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

Method testMainWindow

kdevplatform/shell/tests/test_ktexteditorpluginintegration.cpp:101–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void TestKTextEditorPluginIntegration::testMainWindow()
102{
103 auto window = KTextEditor::Editor::instance()->application()->activeMainWindow();
104 QVERIFY(window);
105 QVERIFY(window->parent());
106 QCOMPARE(window->parent()->metaObject()->className(), "KTextEditorIntegration::MainWindow");
107
108 const auto id = QStringLiteral("kte_integration_toolview");
109 const auto icon = QIcon::fromTheme(QStringLiteral("kdevelop"));
110 const auto text = QStringLiteral("some text");
111 QVERIFY(!findToolView(id));
112
113 auto plugin = new TestPlugin(this);
114 auto toolView = makeQPointer(window->createToolView(plugin, id, KTextEditor::MainWindow::Bottom, icon, text));
115 QVERIFY(toolView);
116
117 auto factory = findToolView(id);
118 QVERIFY(factory);
119
120 // we reuse the same view
121 QWidget parent;
122 auto kdevToolView = makeQPointer(factory->create(&parent));
123 QCOMPARE(kdevToolView->parentWidget(), &parent);
124 QCOMPARE(toolView->parentWidget(), kdevToolView.data());
125
126 // the children are kept alive when the tool view gets destroyed
127 delete kdevToolView;
128 QVERIFY(toolView);
129 kdevToolView = factory->create(&parent);
130 // and we reuse the ktexteditor tool view for the new kdevelop tool view
131 QCOMPARE(toolView->parentWidget(), kdevToolView.data());
132
133 delete toolView;
134 delete kdevToolView;
135
136 delete plugin;
137 QVERIFY(!findToolView(id));
138}
139
140void TestKTextEditorPluginIntegration::testPlugin()
141{

Callers

nothing calls this directly

Calls 9

findToolViewFunction · 0.85
makeQPointerFunction · 0.85
metaObjectMethod · 0.80
createToolViewMethod · 0.80
activeMainWindowMethod · 0.45
parentMethod · 0.45
classNameMethod · 0.45
createMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected