File indexing completed on 2024-05-12 04:38:22
0001 /* 0002 SPDX-FileCopyrightText: 2011 Milian Wolff <mail@milianw.de> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "test_uicontroller.h" 0008 0009 #include <QTest> 0010 #include <KParts/MainWindow> 0011 0012 #include <tests/testcore.h> 0013 #include <tests/autotestshell.h> 0014 #include <interfaces/iuicontroller.h> 0015 0016 QTEST_MAIN(TestUiController) 0017 0018 using namespace KDevelop; 0019 0020 void TestUiController::initTestCase() 0021 { 0022 AutoTestShell::init({{}}); // load no plugins at all 0023 TestCore::initialize(); 0024 } 0025 0026 void TestUiController::cleanupTestCase() 0027 { 0028 TestCore::shutdown(); 0029 } 0030 0031 void TestUiController::showErrorMessage() 0032 { 0033 IUiController* c = ICore::self()->uiController(); 0034 0035 // must be shown otherwise resize has no effect 0036 c->activeMainWindow()->showMaximized(); 0037 QTest::qWait(1000); 0038 0039 int initialWidth = c->activeMainWindow()->width(); 0040 for(int i = 0; i < 10; ++i) { 0041 c->showErrorMessage(QString(500, 'c'), 1); 0042 QTest::qWait(10); 0043 QCOMPARE(c->activeMainWindow()->size().width(), initialWidth); 0044 } 0045 0046 QTest::qWait(1050); 0047 c->showErrorMessage(QString(50000, 'c'), 1); 0048 QTest::qWait(10); 0049 QCOMPARE(c->activeMainWindow()->size().width(), initialWidth); 0050 } 0051 0052 #include "moc_test_uicontroller.cpp"