+#include "config.h"
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <tp-account-widgets/tpaw-live-search.h>
#include "test-helper.h"
#define DEBUG_FLAG EMPATHY_DEBUG_TESTS
-#include <libempathy/empathy-debug.h>
-
-#include <libempathy-gtk/empathy-live-search.h>
+#include "empathy-debug.h"
typedef struct
{
{ "Hello-World", "wo", TRUE },
{ "HelloWorld", "wo", FALSE },
- /* Test accentued letters */
+ /* Test composed chars (accentued letters) */
{ "Jörgen", "jor", TRUE },
{ "Gaëtan", "gaetan", TRUE },
{ "élève", "ele", TRUE },
{ "Azais", "AzaÏs", TRUE },
+ /* Test decomposed chars, they looks the same, but are actually
+ * composed of multiple unicodes */
+ { "Jorgen", "Jör", TRUE },
+ { "Jörgen", "jor", TRUE },
+
/* Multi words */
{ "Xavier Claessens", "Xav Cla", TRUE },
{ "Xavier Claessens", "Cla Xav", TRUE },
{ NULL, NULL, FALSE }
};
guint i;
- gboolean failed = FALSE;
DEBUG ("Started");
for (i = 0; tests[i].string != NULL; i ++)
gboolean match;
gboolean ok;
- match = empathy_live_search_match_string (tests[i].string, tests[i].prefix);
+ match = tpaw_live_search_match_string (tests[i].string, tests[i].prefix);
ok = (match == tests[i].should_match);
- DEBUG ("'%s' - '%s': %s", tests[i].string, tests[i].prefix, ok ? "OK" : "FAILED");
+ DEBUG ("'%s' - '%s' %s: %s", tests[i].string, tests[i].prefix,
+ tests[i].should_match ? "should match" : "should NOT match",
+ ok ? "OK" : "FAILED");
- if (!ok)
- failed = TRUE;
+ g_assert (ok);
}
-
- g_assert (!failed);
}
int