[gtk/matthiasc/for-master] testsuite: Improve coverage for GtkStringFilter
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master] testsuite: Improve coverage for GtkStringFilter
- Date: Sat, 31 Oct 2020 13:24:00 +0000 (UTC)
commit c279bdaa81023e77f4ae18a21d509a87164045ba
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Oct 30 20:15:25 2020 -0400
testsuite: Improve coverage for GtkStringFilter
testsuite/gtk/filter.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/testsuite/gtk/filter.c b/testsuite/gtk/filter.c
index 0370c6b5e0..2ddd0f3ebc 100644
--- a/testsuite/gtk/filter.c
+++ b/testsuite/gtk/filter.c
@@ -275,13 +275,15 @@ test_string_properties (void)
{
GtkFilterListModel *model;
GtkFilter *filter;
+ GtkExpression *expr;
- filter = GTK_FILTER (gtk_string_filter_new (
- gtk_cclosure_expression_new (G_TYPE_STRING,
- NULL,
- 0, NULL,
- G_CALLBACK (get_spelled_out),
- NULL, NULL)));
+ expr = gtk_cclosure_expression_new (G_TYPE_STRING,
+ NULL,
+ 0, NULL,
+ G_CALLBACK (get_spelled_out),
+ NULL, NULL);
+ filter = GTK_FILTER (gtk_string_filter_new (expr));
+ g_assert_true (expr == gtk_string_filter_get_expression (GTK_STRING_FILTER (filter)));
model = new_model (1000, filter);
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "thirte");
@@ -296,12 +298,18 @@ test_string_properties (void)
gtk_string_filter_set_search (GTK_STRING_FILTER (filter), "Thirteen");
assert_model (model, "13");
+ gtk_string_filter_set_match_mode (GTK_STRING_FILTER (filter), GTK_STRING_FILTER_MATCH_MODE_PREFIX);
+ assert_model (model, "13");
+
gtk_string_filter_set_match_mode (GTK_STRING_FILTER (filter), GTK_STRING_FILTER_MATCH_MODE_EXACT);
assert_model (model, "13");
gtk_string_filter_set_ignore_case (GTK_STRING_FILTER (filter), TRUE);
assert_model (model, "13");
+ gtk_string_filter_set_match_mode (GTK_STRING_FILTER (filter), GTK_STRING_FILTER_MATCH_MODE_PREFIX);
+ assert_model (model, "13");
+
gtk_string_filter_set_match_mode (GTK_STRING_FILTER (filter), GTK_STRING_FILTER_MATCH_MODE_SUBSTRING);
assert_model (model, "13 113 213 313 413 513 613 713 813 913");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]