Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/sublime/tests/test_controller.cpp
Context not available. | |||||
40 | 40 | | |||
---|---|---|---|---|---|
41 | void TestController::areaDeletion() | 41 | void TestController::areaDeletion() | ||
42 | { | 42 | { | ||
43 | Controller* controller = new Controller; | 43 | Controller controller; | ||
44 | Document *doc = new ToolDocument(QStringLiteral("tool"), controller, new SimpleToolWidgetFactory<QTextEdit>(QStringLiteral("tool"))); | 44 | Document *doc = new ToolDocument(QStringLiteral("tool"), &controller, new SimpleToolWidgetFactory<QTextEdit>(QStringLiteral("tool"))); | ||
45 | //create a view which does not belong to an area | 45 | //create a view which does not belong to an area | ||
46 | View* view1 = doc->createView(); | 46 | View* view1 = doc->createView(); | ||
47 | Q_UNUSED(view1); | 47 | Q_UNUSED(view1); | ||
48 | //create an area and two views in it | 48 | //create an area and two views in it | ||
49 | Area *area = new Area(controller, QStringLiteral("MyArea")); | 49 | Area *area = new Area(&controller, QStringLiteral("MyArea")); | ||
50 | controller->addDefaultArea(area); | 50 | controller.addDefaultArea(area); | ||
51 | QCOMPARE(controller->defaultAreas().count(), 1); | 51 | QCOMPARE(controller.defaultAreas().count(), 1); | ||
52 | View* view2 = doc->createView(); | 52 | View* view2 = doc->createView(); | ||
53 | view2->setObjectName(QStringLiteral("VIEW2")); | 53 | view2->setObjectName(QStringLiteral("VIEW2")); | ||
54 | area->addView(view2); | 54 | area->addView(view2); | ||
Context not available. | |||||
63 | 63 | | |||
64 | QEXPECT_FAIL("", "Fails because of delayed view deletion", Continue); | 64 | QEXPECT_FAIL("", "Fails because of delayed view deletion", Continue); | ||
65 | QCOMPARE(doc->views().count(), 1); | 65 | QCOMPARE(doc->views().count(), 1); | ||
66 | QCOMPARE(controller->defaultAreas().count(), 0); | 66 | QCOMPARE(controller.defaultAreas().count(), 0); | ||
67 | 67 | | |||
68 | QTest::qWait(100); // wait for deleteLaters | 68 | QTest::qWait(100); // wait for deleteLaters | ||
69 | qDebug() << "Deleting doc"; | 69 | qDebug() << "Deleting doc"; | ||
Context not available. |