Changeset View
Changeset View
Standalone View
Standalone View
tests/units/widgets/filterwidgettest.cpp
Show All 38 Lines | 38 | { | |||
---|---|---|---|---|---|
39 | Q_OBJECT | 39 | Q_OBJECT | ||
40 | private slots: | 40 | private slots: | ||
41 | void shouldHaveDefaultState() | 41 | void shouldHaveDefaultState() | ||
42 | { | 42 | { | ||
43 | Widgets::FilterWidget filter; | 43 | Widgets::FilterWidget filter; | ||
44 | 44 | | |||
45 | QVERIFY(filter.proxyModel()); | 45 | QVERIFY(filter.proxyModel()); | ||
46 | QVERIFY(!filter.proxyModel()->sourceModel()); | 46 | QVERIFY(!filter.proxyModel()->sourceModel()); | ||
47 | QCOMPARE(filter.proxyModel()->filterRegExp(), QRegExp()); | 47 | QCOMPARE(filter.proxyModel()->filterRegularExpression(), QRegularExpression()); | ||
48 | QCOMPARE(filter.proxyModel()->sortOrder(), Qt::AscendingOrder); | 48 | QCOMPARE(filter.proxyModel()->sortOrder(), Qt::AscendingOrder); | ||
49 | QCOMPARE(filter.proxyModel()->sortType(), Presentation::TaskFilterProxyModel::TitleSort); | 49 | QCOMPARE(filter.proxyModel()->sortType(), Presentation::TaskFilterProxyModel::TitleSort); | ||
50 | 50 | | |||
51 | QLineEdit *filterEdit = filter.findChild<QLineEdit*>(QStringLiteral("filterEdit")); | 51 | QLineEdit *filterEdit = filter.findChild<QLineEdit*>(QStringLiteral("filterEdit")); | ||
52 | QVERIFY(filterEdit); | 52 | QVERIFY(filterEdit); | ||
53 | QVERIFY(filterEdit->isVisibleTo(&filter)); | 53 | QVERIFY(filterEdit->isVisibleTo(&filter)); | ||
54 | QVERIFY(filterEdit->text().isEmpty()); | 54 | QVERIFY(filterEdit->text().isEmpty()); | ||
55 | QCOMPARE(filterEdit->placeholderText(), i18n("Filter...")); | 55 | QCOMPARE(filterEdit->placeholderText(), i18n("Filter...")); | ||
Show All 29 Lines | 82 | { | |||
85 | 85 | | |||
86 | QLineEdit *filterEdit = filter.findChild<QLineEdit*>(QStringLiteral("filterEdit")); | 86 | QLineEdit *filterEdit = filter.findChild<QLineEdit*>(QStringLiteral("filterEdit")); | ||
87 | QVERIFY(filterEdit); | 87 | QVERIFY(filterEdit); | ||
88 | 88 | | |||
89 | // WHEN | 89 | // WHEN | ||
90 | QTest::keyClicks(filterEdit, QStringLiteral("find me")); | 90 | QTest::keyClicks(filterEdit, QStringLiteral("find me")); | ||
91 | 91 | | |||
92 | // THEN | 92 | // THEN | ||
93 | QCOMPARE(filter.proxyModel()->filterRegExp().pattern(), QStringLiteral("find me")); | 93 | QCOMPARE(filter.proxyModel()->filterRegularExpression().pattern(), QStringLiteral("find\\ me")); | ||
94 | } | 94 | } | ||
95 | 95 | | |||
96 | void shouldClearFilter() | 96 | void shouldClearFilter() | ||
97 | { | 97 | { | ||
98 | // GIVEN | 98 | // GIVEN | ||
99 | Widgets::FilterWidget filter; | 99 | Widgets::FilterWidget filter; | ||
100 | 100 | | |||
101 | QLineEdit *filterEdit = filter.findChild<QLineEdit*>(QStringLiteral("filterEdit")); | 101 | QLineEdit *filterEdit = filter.findChild<QLineEdit*>(QStringLiteral("filterEdit")); | ||
102 | QVERIFY(filterEdit); | 102 | QVERIFY(filterEdit); | ||
103 | filterEdit->setText("Foo"); | 103 | filterEdit->setText("Foo"); | ||
104 | 104 | | |||
105 | // WHEN | 105 | // WHEN | ||
106 | filter.clear(); | 106 | filter.clear(); | ||
107 | 107 | | |||
108 | // THEN | 108 | // THEN | ||
109 | QVERIFY(filterEdit->text().isEmpty()); | 109 | QVERIFY(filterEdit->text().isEmpty()); | ||
110 | QVERIFY(filter.proxyModel()->filterRegExp().pattern().isEmpty()); | 110 | QVERIFY(filter.proxyModel()->filterRegularExpression().pattern().isEmpty()); | ||
111 | } | 111 | } | ||
112 | 112 | | |||
113 | void shouldShowExtension() | 113 | void shouldShowExtension() | ||
114 | { | 114 | { | ||
115 | // GIVEN | 115 | // GIVEN | ||
116 | Widgets::FilterWidget filter; | 116 | Widgets::FilterWidget filter; | ||
117 | 117 | | |||
118 | QAbstractButton *extensionButton = filter.findChild<QAbstractButton*>(QStringLiteral("extensionButton")); | 118 | QAbstractButton *extensionButton = filter.findChild<QAbstractButton*>(QStringLiteral("extensionButton")); | ||
▲ Show 20 Lines • Show All 99 Lines • Show Last 20 Lines |