Changeset View
Changeset View
Standalone View
Standalone View
tests/units/widgets/pageviewtest.cpp
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Line(s) | 135 | { | |||
---|---|---|---|---|---|
175 | auto removeAction = page.findChild<QAction*>(QStringLiteral("removeItemAction")); | 175 | auto removeAction = page.findChild<QAction*>(QStringLiteral("removeItemAction")); | ||
176 | QVERIFY(removeAction); | 176 | QVERIFY(removeAction); | ||
177 | auto promoteAction = page.findChild<QAction*>(QStringLiteral("promoteItemAction")); | 177 | auto promoteAction = page.findChild<QAction*>(QStringLiteral("promoteItemAction")); | ||
178 | QVERIFY(promoteAction); | 178 | QVERIFY(promoteAction); | ||
179 | auto filterAction = page.findChild<QAction*>(QStringLiteral("filterViewAction")); | 179 | auto filterAction = page.findChild<QAction*>(QStringLiteral("filterViewAction")); | ||
180 | QVERIFY(filterAction); | 180 | QVERIFY(filterAction); | ||
181 | QVERIFY(filterAction->isCheckable()); | 181 | QVERIFY(filterAction->isCheckable()); | ||
182 | QVERIFY(!filterAction->isChecked()); | 182 | QVERIFY(!filterAction->isChecked()); | ||
183 | auto futureAction = page.findChild<QAction*>(QStringLiteral("futureViewAction")); | ||||
184 | QVERIFY(futureAction); | ||||
185 | QVERIFY(futureAction->isCheckable()); | ||||
186 | QVERIFY(!futureAction->isChecked()); | ||||
183 | auto runTaskAction = page.findChild<QAction*>(QStringLiteral("runTaskAction")); | 187 | auto runTaskAction = page.findChild<QAction*>(QStringLiteral("runTaskAction")); | ||
184 | QVERIFY(runTaskAction); | 188 | QVERIFY(runTaskAction); | ||
185 | QVERIFY(!runTaskAction->isEnabled()); | 189 | QVERIFY(!runTaskAction->isEnabled()); | ||
186 | 190 | | |||
187 | auto actions = page.globalActions(); | 191 | auto actions = page.globalActions(); | ||
188 | QCOMPARE(actions.value(QStringLiteral("page_view_add")), addAction); | 192 | QCOMPARE(actions.value(QStringLiteral("page_view_add")), addAction); | ||
189 | QCOMPARE(actions.value(QStringLiteral("page_view_remove")), removeAction); | 193 | QCOMPARE(actions.value(QStringLiteral("page_view_remove")), removeAction); | ||
190 | QCOMPARE(actions.value(QStringLiteral("page_view_promote")), promoteAction); | 194 | QCOMPARE(actions.value(QStringLiteral("page_view_promote")), promoteAction); | ||
191 | QCOMPARE(actions.value(QStringLiteral("page_view_filter")), filterAction); | 195 | QCOMPARE(actions.value(QStringLiteral("page_view_filter")), filterAction); | ||
196 | QCOMPARE(actions.value(QStringLiteral("page_view_future")), futureAction); | ||||
192 | QCOMPARE(actions.value(QStringLiteral("page_run_task")), runTaskAction); | 197 | QCOMPARE(actions.value(QStringLiteral("page_run_task")), runTaskAction); | ||
193 | } | 198 | } | ||
194 | 199 | | |||
195 | void shouldDisplayListFromPageModel() | 200 | void shouldDisplayListFromPageModel() | ||
196 | { | 201 | { | ||
197 | // GIVEN | 202 | // GIVEN | ||
198 | QStandardItemModel model; | 203 | QStandardItemModel model; | ||
199 | 204 | | |||
▲ Show 20 Lines • Show All 137 Lines • ▼ Show 20 Line(s) | 309 | { | |||
337 | 342 | | |||
338 | // THEN | 343 | // THEN | ||
339 | QVERIFY(centralView->hasFocus()); | 344 | QVERIFY(centralView->hasFocus()); | ||
340 | QVERIFY(!filter->isVisibleTo(&page)); | 345 | QVERIFY(!filter->isVisibleTo(&page)); | ||
341 | QVERIFY(!filterEdit->hasFocus()); | 346 | QVERIFY(!filterEdit->hasFocus()); | ||
342 | QVERIFY(filterEdit->text().isEmpty()); | 347 | QVERIFY(filterEdit->text().isEmpty()); | ||
343 | } | 348 | } | ||
344 | 349 | | |||
350 | void shouldManageFutureTasksVisibilityThroughAction() | ||||
351 | { | ||||
352 | // GIVEN | ||||
353 | Widgets::PageView page; | ||||
354 | auto filter = page.findChild<Widgets::FilterWidget*>(QStringLiteral("filterWidget")); | ||||
355 | auto filterProxy = filter->proxyModel(); | ||||
356 | QVERIFY(filterProxy); | ||||
357 | | ||||
358 | QVERIFY(!filterProxy->showFutureTasks()); | ||||
359 | | ||||
360 | auto futureAction = page.findChild<QAction*>(QStringLiteral("futureViewAction")); | ||||
361 | | ||||
362 | // WHEN | ||||
363 | futureAction->trigger(); | ||||
364 | | ||||
365 | // THEN | ||||
366 | QVERIFY(filterProxy->showFutureTasks()); | ||||
367 | | ||||
368 | // WHEN | ||||
369 | futureAction->trigger(); | ||||
370 | | ||||
371 | // THEN | ||||
372 | QVERIFY(!filterProxy->showFutureTasks()); | ||||
373 | } | ||||
374 | | ||||
345 | void shouldCreateTasksWithNoParentWhenHittingReturnWithoutSelectedIndex() | 375 | void shouldCreateTasksWithNoParentWhenHittingReturnWithoutSelectedIndex() | ||
346 | { | 376 | { | ||
347 | // GIVEN | 377 | // GIVEN | ||
348 | PageModelStub stubPageModel; | 378 | PageModelStub stubPageModel; | ||
349 | Widgets::PageView page; | 379 | Widgets::PageView page; | ||
350 | page.setModel(&stubPageModel); | 380 | page.setModel(&stubPageModel); | ||
351 | auto quickAddEdit = page.findChild<QLineEdit*>(QStringLiteral("quickAddEdit")); | 381 | auto quickAddEdit = page.findChild<QLineEdit*>(QStringLiteral("quickAddEdit")); | ||
352 | 382 | | |||
▲ Show 20 Lines • Show All 396 Lines • Show Last 20 Lines |