Changeset View
Changeset View
Standalone View
Standalone View
kdevplatform/sublime/tests/test_viewactivation.cpp
Context not available. | |||||
143 | dock->setWidget(toolBreaker); | 143 | dock->setWidget(toolBreaker); | ||
---|---|---|---|---|---|
144 | mw->addDockWidget(Qt::LeftDockWidgetArea, dock); | 144 | mw->addDockWidget(Qt::LeftDockWidgetArea, dock); | ||
145 | 145 | | |||
146 | QFocusEvent focusEvent(QEvent::FocusIn); | ||||
146 | //now post events to the widgets and see if mainwindow has the right active views | 147 | //now post events to the widgets and see if mainwindow has the right active views | ||
147 | //activate view | 148 | //activate view | ||
148 | qApp->sendEvent(view212->widget(), new QFocusEvent(QEvent::FocusIn)); | 149 | qApp->sendEvent(view212->widget(), &focusEvent); | ||
149 | QString failMsg = QStringLiteral("\nWas expecting %1 to be active but got %2"). | 150 | QString failMsg = QStringLiteral("\nWas expecting %1 to be active but got %2"). | ||
150 | arg(view212->objectName(), mw->activeView()->objectName()); | 151 | arg(view212->objectName(), mw->activeView()->objectName()); | ||
151 | QVERIFY2(mw->activeView() == view212, failMsg.toLatin1().data()); | 152 | QVERIFY2(mw->activeView() == view212, failMsg.toLatin1().data()); | ||
152 | 153 | | |||
153 | //activate tool view and check that both view and tool view are active | 154 | //activate tool view and check that both view and tool view are active | ||
154 | qApp->sendEvent(viewT31->widget(), new QFocusEvent(QEvent::FocusIn)); | 155 | qApp->sendEvent(viewT31->widget(), &focusEvent); | ||
155 | QCOMPARE(mw->activeView(), view212); | 156 | QCOMPARE(mw->activeView(), view212); | ||
156 | QCOMPARE(mw->activeToolView(), viewT31); | 157 | QCOMPARE(mw->activeToolView(), viewT31); | ||
157 | 158 | | |||
158 | //active another view | 159 | //active another view | ||
159 | qApp->sendEvent(view241->widget(), new QFocusEvent(QEvent::FocusIn)); | 160 | qApp->sendEvent(view241->widget(), &focusEvent); | ||
160 | QCOMPARE(mw->activeView(), view241); | 161 | QCOMPARE(mw->activeView(), view241); | ||
161 | QCOMPARE(mw->activeToolView(), viewT31); | 162 | QCOMPARE(mw->activeToolView(), viewT31); | ||
162 | 163 | | |||
163 | //focus a widget not in the area | 164 | //focus a widget not in the area | ||
164 | qApp->sendEvent(breaker, new QFocusEvent(QEvent::FocusIn)); | 165 | qApp->sendEvent(breaker, &focusEvent); | ||
165 | QCOMPARE(mw->activeView(), view241); | 166 | QCOMPARE(mw->activeView(), view241); | ||
166 | QCOMPARE(mw->activeToolView(), viewT31); | 167 | QCOMPARE(mw->activeToolView(), viewT31); | ||
167 | 168 | | |||
168 | //focus a dock not in the area | 169 | //focus a dock not in the area | ||
169 | qApp->sendEvent(toolBreaker, new QFocusEvent(QEvent::FocusIn)); | 170 | qApp->sendEvent(toolBreaker, &focusEvent); | ||
170 | QCOMPARE(mw->activeView(), view241); | 171 | QCOMPARE(mw->activeView(), view241); | ||
171 | QCOMPARE(mw->activeToolView(), viewT31); | 172 | QCOMPARE(mw->activeToolView(), viewT31); | ||
172 | 173 | | |||
173 | //focus inner widget for view221 | 174 | //focus inner widget for view221 | ||
174 | QListView *inner = mw->findChild<QListView*>(QStringLiteral("doc2_inner")); | 175 | QListView *inner = mw->findChild<QListView*>(QStringLiteral("doc2_inner")); | ||
175 | QVERIFY(inner); | 176 | QVERIFY(inner); | ||
176 | qApp->sendEvent(inner, new QFocusEvent(QEvent::FocusIn)); | 177 | qApp->sendEvent(inner, &focusEvent); | ||
177 | QCOMPARE(mw->activeView(), view221); | 178 | QCOMPARE(mw->activeView(), view221); | ||
178 | QCOMPARE(mw->activeToolView(), viewT31); | 179 | QCOMPARE(mw->activeToolView(), viewT31); | ||
179 | } | 180 | } | ||
Context not available. |