author | Maciej Seroka <maciejs@symbian.org> |
Thu, 11 Nov 2010 14:03:20 +0000 | |
changeset 26 | 26ffa9d5444d |
parent 2 | 0cb2248d0edc |
permissions | -rw-r--r-- |
2
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
1 |
/* |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
3 |
* All rights reserved. |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
8 |
* |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
9 |
* Initial Contributors: |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
11 |
* |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
12 |
* Contributors: |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
13 |
* |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
14 |
* Description: ?Description |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
15 |
* |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
16 |
*/ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
17 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
18 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
19 |
#undef G_DISABLE_ASSERT |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
20 |
#undef G_LOG_DOMAIN |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
21 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
22 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
23 |
#include <stdio.h> |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
24 |
#include <string.h> |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
25 |
#include <glib.h> |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
26 |
#include <fcntl.h> |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
27 |
#include <goption.h> |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
28 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
29 |
#ifdef SYMBIAN |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
30 |
#include "mrt2_glib2_test.h" |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
31 |
#endif /*SYMBIAN*/ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
32 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
33 |
#define C2P(c) ((gpointer) ((long) (c))) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
34 |
#define GINT_TO_POINTER(i) ((gpointer) (i)) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
35 |
#define GPOINTER_TO_INT(p) ((gint) (p)) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
36 |
#define TESTPASS 1 |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
37 |
#define TESTFAIL 0 |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
38 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
39 |
int arg_test1_int; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
40 |
int arg_test2_int; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
41 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
42 |
static gboolean error_test1_pre_parse (GOptionContext *context, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
43 |
GOptionGroup *group, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
44 |
gpointer data, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
45 |
GError **error) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
46 |
{ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
47 |
g_assert (arg_test1_int == 0x12345678); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
48 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
49 |
return TRUE; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
50 |
} |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
51 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
52 |
static gboolean error_test1_post_parse (GOptionContext *context, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
53 |
GOptionGroup *group, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
54 |
gpointer data, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
55 |
GError **error) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
56 |
{ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
57 |
g_assert (arg_test1_int == 20); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
58 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
59 |
/* Set an error in the post hook */ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
60 |
g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, ""); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
61 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
62 |
return FALSE; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
63 |
} |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
64 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
65 |
gchar** split_string (const char *str, int *argc) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
66 |
{ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
67 |
gchar **argv; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
68 |
int len; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
69 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
70 |
argv = g_strsplit (str, " ", 0); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
71 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
72 |
for (len = 0; argv[len] != NULL; len++); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
73 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
74 |
if (argc) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
75 |
*argc = len; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
76 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
77 |
return argv; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
78 |
} |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
79 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
80 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
81 |
void error_func (GOptionContext *context,GOptionGroup *group, gpointer data,GError **error) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
82 |
{ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
83 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
84 |
} |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
85 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
86 |
void tg_option_tests() |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
87 |
{ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
88 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
89 |
GOptionContext *context; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
90 |
GOptionContext *context1;//for testing set main group |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
91 |
GOptionContext *context2;//for testing add group |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
92 |
gboolean retval; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
93 |
GError *error = NULL; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
94 |
gchar **argv; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
95 |
int argc; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
96 |
gchar **argv1; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
97 |
int argc1; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
98 |
GOptionEntry entries [] = |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
99 |
{ { "test", 0, 0, G_OPTION_ARG_INT, &arg_test1_int, "test_description", "test_arg" }, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
100 |
{ NULL } }; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
101 |
GOptionEntry entries1 [] = |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
102 |
{ { "try", 0, 0, G_OPTION_ARG_INT, &arg_test1_int, "try_description", "try_arg" }, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
103 |
{ NULL } }; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
104 |
GOptionEntry entries2 [] = |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
105 |
{ { "again", 0, 0, G_OPTION_ARG_INT, &arg_test1_int, "again_description", "again_arg" }, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
106 |
{ NULL } }; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
107 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
108 |
GOptionGroup *main_group; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
109 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
110 |
context = g_option_context_new (NULL); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
111 |
context1 = g_option_context_new (NULL); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
112 |
context2 = g_option_context_new (NULL); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
113 |
g_option_context_add_main_entries (context, entries, NULL); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
114 |
g_option_context_add_main_entries (context2, entries, NULL); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
115 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
116 |
main_group = g_option_context_get_main_group (context); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
117 |
//Testing g_option_context_set_main_group with another context-context1 |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
118 |
g_option_group_add_entries (main_group,entries1); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
119 |
g_option_context_set_main_group(context1,main_group); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
120 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
121 |
//Testing g_option_context_set_help_enabled |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
122 |
//and g_option_context_get_help_enabled |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
123 |
//and g_option_context_get_ignore_unknown_options |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
124 |
g_option_context_set_help_enabled(context,TRUE); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
125 |
g_assert(g_option_context_get_help_enabled(context)); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
126 |
g_assert(!g_option_context_get_ignore_unknown_options(context)); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
127 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
128 |
/* Now try parsing on context1*/ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
129 |
argv = split_string ("program --try 20 --try 30", &argc); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
130 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
131 |
retval = g_option_context_parse (context1, &argc, &argv, &error); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
132 |
g_assert (retval); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
133 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
134 |
/* Last arg specified is the one that should be stored */ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
135 |
g_assert (arg_test1_int == 30); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
136 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
137 |
g_option_group_set_error_hook (main_group, error_func); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
138 |
argv = split_string ("program --none 20 --none 30", &argc); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
139 |
retval = g_option_context_parse (context1, &argc, &argv, &error); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
140 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
141 |
g_strfreev (argv); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
142 |
g_option_context_free (context); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
143 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
144 |
} |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
145 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
146 |
void g_option_context_add_group_test() |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
147 |
{ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
148 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
149 |
GOptionContext *context; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
150 |
GOptionEntry entries [] = |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
151 |
{ { "test", 0, 0, G_OPTION_ARG_INT, &arg_test2_int, "test_description", "test_arg" }, |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
152 |
{ NULL } }; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
153 |
GOptionGroup *group; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
154 |
gboolean retval; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
155 |
GError *error = NULL; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
156 |
gchar **argv; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
157 |
int argc; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
158 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
159 |
group = g_option_group_new ("test","test_description","help_desc",NULL,NULL); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
160 |
g_option_group_add_entries (group, entries); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
161 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
162 |
context = g_option_context_new (NULL); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
163 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
164 |
//Testing this:g_option_context_add_group |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
165 |
g_option_context_add_group (context, group); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
166 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
167 |
/* Now try parsing on context1*/ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
168 |
argv = split_string ("program --test 20 --test 30", &argc); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
169 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
170 |
retval = g_option_context_parse (context, &argc, &argv, &error); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
171 |
g_assert (retval); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
172 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
173 |
/* Last arg specified is the one that should be stored */ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
174 |
g_assert (arg_test2_int == 30); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
175 |
g_strfreev (argv); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
176 |
g_option_context_free (context); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
177 |
} |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
178 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
179 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
180 |
int main (int argc,char *argv[]) |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
181 |
{ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
182 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
183 |
#ifdef SYMBIAN |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
184 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
185 |
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); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
186 |
#endif /*SYMBIAN*/ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
187 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
188 |
tg_option_tests(); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
189 |
g_option_context_add_group_test(); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
190 |
|
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
191 |
#ifdef SYMBIAN |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
192 |
testResultXml("toption"); |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
193 |
#endif /* EMULATOR */ |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
194 |
return 0; |
0cb2248d0edc
New BC drivers added are - Phonebook, Speed dial utility control, MMS Client MTM, Plugin Bio control, Organizer,
shrivatsa
parents:
diff
changeset
|
195 |
} |