1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/glib/tsrc/BC/tests/completion-test.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,78 @@
1.4 +/* GLIB - Library of useful routines for C programming
1.5 + * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
1.6 + * Portion Copyright © 2008-09 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.7 + * This library is free software; you can redistribute it and/or
1.8 + * modify it under the terms of the GNU Lesser General Public
1.9 + * License as published by the Free Software Foundation; either
1.10 + * version 2 of the License, or (at your option) any later version.
1.11 + *
1.12 + * This library is distributed in the hope that it will be useful,
1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1.15 + * Lesser General Public License for more details.
1.16 + *
1.17 + * You should have received a copy of the GNU Lesser General Public
1.18 + * License along with this library; if not, write to the
1.19 + * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
1.20 + * Boston, MA 02111-1307, USA.
1.21 + */
1.22 +
1.23 +/*
1.24 + * Modified by the GLib Team and others 1997-2000. See the AUTHORS
1.25 + * file for a list of people on the GLib Team. See the ChangeLog
1.26 + * files for a list of changes. These files are distributed with
1.27 + * GLib at ftp://ftp.gtk.org/pub/gtk/.
1.28 + */
1.29 +#include <string.h>
1.30 +#include <stdio.h>
1.31 +
1.32 +#include "glib.h"
1.33 +
1.34 +#ifdef SYMBIAN
1.35 +#include "mrt2_glib2_test.h"
1.36 +#endif /*SYMBIAN*/
1.37 +
1.38 +
1.39 +int main (int argc, char *argv[])
1.40 +{
1.41 + GCompletion *cmp;
1.42 + GList *items;
1.43 + gchar *prefix;
1.44 +
1.45 + #ifdef SYMBIAN
1.46 + g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
1.47 + g_set_print_handler(mrtPrintHandler);
1.48 + #endif /*SYMBIAN*/
1.49 +
1.50 +
1.51 + cmp = g_completion_new (NULL);
1.52 +
1.53 + items = NULL;
1.54 + items = g_list_append (items, "a\302\243");
1.55 + items = g_list_append (items, "a\302\244");
1.56 + items = g_list_append (items, "bb");
1.57 + items = g_list_append (items, "bc");
1.58 + g_completion_add_items (cmp, items);
1.59 +
1.60 + items = g_completion_complete (cmp, "a", &prefix);
1.61 + g_assert (!strcmp ("a\302", prefix));
1.62 + g_free (prefix);
1.63 +
1.64 + items = g_completion_complete_utf8 (cmp, "a", &prefix);
1.65 + g_assert (!strcmp ("a", prefix));
1.66 + g_free (prefix);
1.67 +
1.68 + items = g_completion_complete (cmp, "b", &prefix);
1.69 + g_assert (!strcmp ("b", prefix));
1.70 + g_free (prefix);
1.71 +
1.72 + items = g_completion_complete_utf8 (cmp, "b", &prefix);
1.73 + g_assert (!strcmp ("b", prefix));
1.74 + g_free (prefix);
1.75 +
1.76 + #if SYMBIAN
1.77 + testResultXml("completion-test");
1.78 + #endif /* EMULATOR */
1.79 +
1.80 + return 0;
1.81 +}