Changeset View
Changeset View
Standalone View
Standalone View
tests/units/presentation/taskfilterproxymodeltest.cpp
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Line(s) | 75 | { | |||
---|---|---|---|---|---|
78 | input.appendRow(createTaskItem(QStringLiteral("1. foo"), QStringLiteral("find me"))); | 78 | input.appendRow(createTaskItem(QStringLiteral("1. foo"), QStringLiteral("find me"))); | ||
79 | input.appendRow(createTaskItem(QStringLiteral("2. Find Me"), QStringLiteral("bar"))); | 79 | input.appendRow(createTaskItem(QStringLiteral("2. Find Me"), QStringLiteral("bar"))); | ||
80 | input.appendRow(createTaskItem(QStringLiteral("3. baz"), QStringLiteral("baz"))); | 80 | input.appendRow(createTaskItem(QStringLiteral("3. baz"), QStringLiteral("baz"))); | ||
81 | 81 | | |||
82 | Presentation::TaskFilterProxyModel output; | 82 | Presentation::TaskFilterProxyModel output; | ||
83 | output.setSourceModel(&input); | 83 | output.setSourceModel(&input); | ||
84 | 84 | | |||
85 | // WHEN | 85 | // WHEN | ||
86 | output.setFilterFixedString(QStringLiteral("find me")); | 86 | output.setFilterRegularExpression(QStringLiteral("find me")); | ||
87 | 87 | | |||
88 | // THEN | 88 | // THEN | ||
89 | QCOMPARE(output.rowCount(), 2); | 89 | QCOMPARE(output.rowCount(), 2); | ||
90 | QCOMPARE(output.index(0, 0).data().toString(), QStringLiteral("1. foo")); | 90 | QCOMPARE(output.index(0, 0).data().toString(), QStringLiteral("1. foo")); | ||
91 | QCOMPARE(output.index(1, 0).data().toString(), QStringLiteral("2. Find Me")); | 91 | QCOMPARE(output.index(1, 0).data().toString(), QStringLiteral("2. Find Me")); | ||
92 | } | 92 | } | ||
93 | 93 | | |||
94 | void shouldFilterByStartDate() | 94 | void shouldFilterByStartDate() | ||
Show All 39 Lines | 128 | { | |||
134 | item->appendRow(createTaskItem(QStringLiteral("22. find me"), QStringLiteral("foo"))); | 134 | item->appendRow(createTaskItem(QStringLiteral("22. find me"), QStringLiteral("foo"))); | ||
135 | input.appendRow(item); | 135 | input.appendRow(item); | ||
136 | input.appendRow(createTaskItem(QStringLiteral("3. baz"), QStringLiteral("baz"))); | 136 | input.appendRow(createTaskItem(QStringLiteral("3. baz"), QStringLiteral("baz"))); | ||
137 | 137 | | |||
138 | Presentation::TaskFilterProxyModel output; | 138 | Presentation::TaskFilterProxyModel output; | ||
139 | output.setSourceModel(&input); | 139 | output.setSourceModel(&input); | ||
140 | 140 | | |||
141 | // WHEN | 141 | // WHEN | ||
142 | output.setFilterFixedString(QStringLiteral("find me")); | 142 | output.setFilterRegularExpression(QStringLiteral("find me")); | ||
143 | 143 | | |||
144 | // THEN | 144 | // THEN | ||
145 | QCOMPARE(output.rowCount(), 2); | 145 | QCOMPARE(output.rowCount(), 2); | ||
146 | QCOMPARE(output.index(0, 0).data().toString(), QStringLiteral("1. foo")); | 146 | QCOMPARE(output.index(0, 0).data().toString(), QStringLiteral("1. foo")); | ||
147 | QCOMPARE(output.index(1, 0).data().toString(), QStringLiteral("2. baz")); | 147 | QCOMPARE(output.index(1, 0).data().toString(), QStringLiteral("2. baz")); | ||
148 | 148 | | |||
149 | const QModelIndex parent = output.index(1, 0); | 149 | const QModelIndex parent = output.index(1, 0); | ||
150 | QCOMPARE(output.rowCount(parent), 1); | 150 | QCOMPARE(output.rowCount(parent), 1); | ||
▲ Show 20 Lines • Show All 121 Lines • Show Last 20 Lines |