File indexing completed on 2024-05-19 04:39:50

0001 /*
0002     SPDX-FileCopyrightText: 2007 Alexander Dymo <adymo@kdevelop.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "test_document.h"
0008 
0009 #include <QTextEdit>
0010 #include <QTest>
0011 #include <QStandardPaths>
0012 
0013 #include <sublime/controller.h>
0014 #include <sublime/tooldocument.h>
0015 #include <sublime/view.h>
0016 
0017 using namespace Sublime;
0018 
0019 void TestDocument::initTestCase()
0020 {
0021     QStandardPaths::setTestModeEnabled(true);
0022 }
0023 
0024 void TestDocument::viewDeletion()
0025 {
0026     Controller controller;
0027     Document *doc = new ToolDocument(QStringLiteral("tool"), &controller, new SimpleToolWidgetFactory<QTextEdit>(QStringLiteral("tool")));
0028 
0029     View *view = doc->createView();
0030     view->widget();
0031     QCOMPARE(doc->views().count(), 1);
0032 
0033     delete view;
0034     QCOMPARE(doc->views().count(), 0);
0035 }
0036 
0037 QTEST_MAIN(TestDocument)
0038 
0039 #include "moc_test_document.cpp"