os/ossrv/glib/tsrc/BC/tests/completion-test.c
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/* GLIB - Library of useful routines for C programming
sl@0
     2
 * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
sl@0
     3
 * Portion Copyright © 2008-09 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
sl@0
     4
 * This library is free software; you can redistribute it and/or
sl@0
     5
 * modify it under the terms of the GNU Lesser General Public
sl@0
     6
 * License as published by the Free Software Foundation; either
sl@0
     7
 * version 2 of the License, or (at your option) any later version.
sl@0
     8
 *
sl@0
     9
 * This library is distributed in the hope that it will be useful,
sl@0
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
sl@0
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
sl@0
    12
 * Lesser General Public License for more details.
sl@0
    13
 *
sl@0
    14
 * You should have received a copy of the GNU Lesser General Public
sl@0
    15
 * License along with this library; if not, write to the
sl@0
    16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
sl@0
    17
 * Boston, MA 02111-1307, USA.
sl@0
    18
 */
sl@0
    19
sl@0
    20
/*
sl@0
    21
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
sl@0
    22
 * file for a list of people on the GLib Team.  See the ChangeLog
sl@0
    23
 * files for a list of changes.  These files are distributed with
sl@0
    24
 * GLib at ftp://ftp.gtk.org/pub/gtk/. 
sl@0
    25
 */
sl@0
    26
#include <string.h>
sl@0
    27
#include <stdio.h>
sl@0
    28
sl@0
    29
#include "glib.h"
sl@0
    30
sl@0
    31
#ifdef SYMBIAN
sl@0
    32
#include "mrt2_glib2_test.h"
sl@0
    33
#endif /*SYMBIAN*/
sl@0
    34
sl@0
    35
sl@0
    36
int main (int argc, char *argv[])
sl@0
    37
{
sl@0
    38
  GCompletion *cmp;
sl@0
    39
  GList *items;
sl@0
    40
  gchar *prefix;
sl@0
    41
  
sl@0
    42
  #ifdef SYMBIAN
sl@0
    43
  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);
sl@0
    44
  g_set_print_handler(mrtPrintHandler);
sl@0
    45
  #endif /*SYMBIAN*/
sl@0
    46
	  
sl@0
    47
sl@0
    48
  cmp = g_completion_new (NULL);
sl@0
    49
sl@0
    50
  items = NULL;
sl@0
    51
  items = g_list_append (items, "a\302\243");
sl@0
    52
  items = g_list_append (items, "a\302\244");
sl@0
    53
  items = g_list_append (items, "bb");
sl@0
    54
  items = g_list_append (items, "bc");
sl@0
    55
  g_completion_add_items (cmp, items);
sl@0
    56
sl@0
    57
  items = g_completion_complete (cmp, "a", &prefix);
sl@0
    58
  g_assert (!strcmp ("a\302", prefix));
sl@0
    59
  g_free (prefix);
sl@0
    60
  
sl@0
    61
  items = g_completion_complete_utf8 (cmp, "a", &prefix);
sl@0
    62
  g_assert (!strcmp ("a", prefix));
sl@0
    63
  g_free (prefix);
sl@0
    64
sl@0
    65
  items = g_completion_complete (cmp, "b", &prefix);
sl@0
    66
  g_assert (!strcmp ("b", prefix));
sl@0
    67
  g_free (prefix);
sl@0
    68
  
sl@0
    69
  items = g_completion_complete_utf8 (cmp, "b", &prefix);
sl@0
    70
  g_assert (!strcmp ("b", prefix));
sl@0
    71
  g_free (prefix);
sl@0
    72
  
sl@0
    73
  #if SYMBIAN
sl@0
    74
  testResultXml("completion-test");
sl@0
    75
  #endif /* EMULATOR */
sl@0
    76
sl@0
    77
  return 0;
sl@0
    78
}