| 99 | } |
| 100 | |
| 101 | void 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 | |
| 140 | void TestKTextEditorPluginIntegration::testPlugin() |
| 141 | { |
nothing calls this directly
no test coverage detected