Status: | Merged |
---|---|
Merged at revision: | 88 |
Proposed branch: | lp:geis/2.x |
Merge into: | lp:geis |
Diff against target: |
1260 lines (+990/-32) 26 files modified
.bzrignore (+4/-0) ChangeLog (+138/-0) Makefile.am (+1/-1) configure.ac (+21/-0) include/geis/geis.h (+86/-1) libutouch-geis-xcb/Makefile.am (+4/-9) libutouch-geis-xcb/libutouch-geis-xcb.ver (+0/-15) libutouch-geis/Makefile.am (+47/-0) libutouch-geis/geis.c (+104/-0) libutouch-geis/geis_error.c (+143/-0) libutouch-geis/geis_error.h (+42/-0) libutouch-geis/geis_private.h (+36/-0) libutouch-geis/libutouch-geis.ver (+24/-0) testsuite/Makefile.am (+24/-1) testsuite/geis1/Makefile.am (+1/-1) testsuite/geis1/check_geis_internals.c (+1/-1) testsuite/geis2/Makefile.am (+36/-0) testsuite/geis2/check_error_codes.c (+31/-0) testsuite/geis2/check_geis2_api.c (+32/-0) testsuite/geis2/check_geis_new.c (+32/-0) testsuite/geis2/check_general_types.c (+32/-0) testsuite/geis2/check_version_macro.c (+32/-0) testsuite/geistest/Makefile.am (+1/-3) testsuite/libutouch-geis/Makefile.am (+53/-0) testsuite/libutouch-geis/check_error_reporting.c (+39/-0) testsuite/libutouch-geis/check_geis2_internals.c (+26/-0) |
To merge this branch: | bzr merge lp:geis/2.x |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mohamed IKBEL Boulabiar (community) | Approve | ||
Henrik Rydberg (community) | Approve | ||
Chase Douglas (community) | Approve | ||
Review via email: mp+41766@code.launchpad.net |
Commit message
Description of the change
This looks like a big delta (and maybe it is) but it's mostly a bunch of boilerplate unit test code for implementing the GEIS v2.0 spec, plus sections 3.1 (general) and parts of 3.2 (library initialization) of the proposed GEIS v2.0 C Binding specification <https:/
The test suite is run with "make check" (requires the "check" package to be installed). Other build dependencies can be gleaned from the Ubuntu packaging.
The libutouch-geis library will continue to maintain backwards API and ABI compatibility with GEIS v1.0 after this.
Mohamed IKBEL Boulabiar (boulabiar) wrote : | # |
in the libutouch-
For the rest, everything looks pretty nice.
Preview Diff
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2010-11-12 15:54:32 +0000 |
3 | +++ .bzrignore 2010-11-24 17:23:10 +0000 |
4 | @@ -29,6 +29,10 @@ |
5 | libtool |
6 | Makefile |
7 | stamp-* |
8 | +testsuite/libutouch-geis/check_geis2_internals |
9 | +testsuite/libutouch-geis/*.log |
10 | testsuite/geis1/check_geis_internals |
11 | testsuite/geis1/*.log |
12 | +testsuite/geis2/check_geis2_api |
13 | +testsuite/geis2/*.log |
14 | testsuite/geistest/geistest |
15 | |
16 | === modified file 'ChangeLog' |
17 | --- ChangeLog 2010-11-12 15:54:32 +0000 |
18 | +++ ChangeLog 2010-11-24 17:23:10 +0000 |
19 | @@ -1,3 +1,141 @@ |
20 | +2010-11-24 Stephen M. Webb <stephen.webb@canonical.com> |
21 | + |
22 | + Fixed a "make distcheck" problem. |
23 | + |
24 | + * testsuite/libutouch-geis/Makefile.am (check_geis2_internals_CFLAGS): added |
25 | + $(top_srcdir) to the header search path |
26 | + |
27 | +2010-11-24 Stephen M. Webb <stephen.webb@canonical.com> |
28 | + |
29 | + Added unit testing for uTouch GEIS v2.0 internals. |
30 | + |
31 | + * testsuite/libutouch-geis: new subdirectory |
32 | + * testsuite/libutouch-geis/Makefile.am: new file |
33 | + * testsuite/libutouch-geis/check_error_reporting.c: new file |
34 | + * testsuite/libutouch-geis/check_geis2_internals.c: new file |
35 | + * configure.ac (AC_OUTPUT): added new Makefile |
36 | + * testsuite/Makefile.am (SUBDIRS): added new subdirectory |
37 | + * testsuite/geis1/check_geis_internals.c: renamed test suite |
38 | + * testsuite/geis2/check_geis2_api.c: renamed test suite |
39 | + |
40 | +2010-11-23 Stephen M. Webb <stephen.webb@canonical.com> |
41 | + |
42 | + Added Error Reporting functions. |
43 | + |
44 | + * libutouch-geis/geis_error.c: new file |
45 | + * libutouch-geis/geis_error.h: new file |
46 | + * libutouch-geis/geis_private.h: new file |
47 | + * include/geis/geis.h (geis_error_count): new function |
48 | + (geis_error_code): new function |
49 | + (geis_error_message): new function |
50 | + * libutouch-geis/Makefile.am: added new files |
51 | + * libutouch-geis/geis.c: used new functions |
52 | + * libutouch-geis/libutouch-geis.ver: added new function symbols |
53 | + |
54 | +2010-11-23 Stephen M. Webb <stephen.webb@canonical.com> |
55 | + |
56 | + Added diagnostics to geis_new(). |
57 | + |
58 | + * libutouch-geis/geis.c (geis_error): reported calloc failure |
59 | + (geis_set_valist): added debug diagnostics for init args |
60 | + |
61 | +2010-11-23 Stephen M. Webb <stephen.webb@canonical.com> |
62 | + |
63 | + Moved diagnostic logging from GEIS v1.0 to GEIS v2.0 libraries. |
64 | + |
65 | + * libutouch-geis/geis_logging.h: renamed from libutouch-geis-xcb/geis_logging.h |
66 | + * libutouch-geis/geis_logging.c: renamed from libutouch-geis-xcb/geis_logging.c |
67 | + * libutouch-geis-xcb/Makefile.am: removed above renamed files |
68 | + * libutouch-geis/Makefile.am: added above renamed files |
69 | + * testsuite/geis1/Makefile.am: changed library path |
70 | + * testsuite/geistest/Makefile.am: changed library path |
71 | + |
72 | +2010-11-23 Stephen M. Webb <stephen.webb@canonical.com> |
73 | + |
74 | + Merged GEIS v1.0 into GEIS v2.0 library for backwards compatibility. |
75 | + |
76 | + * libutouch-geis-xcb/libutouch-geis-xcb.ver: removed |
77 | + * libutouch-geis-xcb/Makefile.am: converted to build a convenience lib |
78 | + * libutouch-geis/Makefile.am: added libutouch-geis-xcb as a conveniemnce lib |
79 | + * libutouch-geis/libutouch-geis.ver: Added GEIS v1.0 symbols |
80 | + * testsuite/geis2/Makefile.am: fixed path to shared library in build tree |
81 | + |
82 | +2010-11-22 Stephen M. Webb <stephen.webb@canonical.com> |
83 | + |
84 | + Refactored API initialization to use variadic arguments a la spec change. |
85 | + |
86 | + * include/geis/geis.h (geis_new): changed function prototype |
87 | + * libutouch-geis/geis.c (geis_new_empty): new function |
88 | + (geis_set_valist): new function |
89 | + (geis_new): changed parameters, used new functions |
90 | + * testsuite/geis2/check_geis_new.c (geis_new_and_delete): changed geis_new() |
91 | + arguments |
92 | + |
93 | +2010-11-22 Stephen M. Webb <stephen.webb@canonical.com> |
94 | + |
95 | + Fixed visibility of new GEIS 2.0 symbols. |
96 | + |
97 | + * include/geis/geis.h (geis_new): fixed visibility |
98 | + (geis_delete): same |
99 | + |
100 | +2010-11-22 Stephen M. Webb <stephen.webb@canonical.com> |
101 | + |
102 | + Made geis2_geis_new test case pass. |
103 | + |
104 | + * libutouch-geis/geis.c (geis_hints_find_by_id): new static function |
105 | + (geis_hints_append): new static function |
106 | + (geis_new): used them, malloc'd struct _Geis |
107 | + (geis_delete): free'd struct _Geis |
108 | + |
109 | +2010-11-22 Stephen M. Webb <stephen.webb@canonical.com> |
110 | + |
111 | + Added test case for GEIS v2.0 geis_new() and geis_delete() functions, together |
112 | + with a skeletal implementation of the libutouch-geis v2.0 library. |
113 | + |
114 | + * libutouch-geis: new source directory |
115 | + * libutouch-geis/Makefile.am: new build recipe for libutouch-geis v2.0 |
116 | + * libutouch-geis/geis.c: new source file |
117 | + * libutouch-geis/libutouch-geis.ver: new library version map |
118 | + * testsuite/geis2/check_geis_new.c: new test suite |
119 | + * Makefile.am (SUBDIRS): added libutouch-geis |
120 | + * configure.ac (AC_OUTPUT): added libutouch-geis/Makefile |
121 | + * include/geis/geis.h (GeisHints): new data structure |
122 | + (Geis): new opaque data structure |
123 | + (geis_new): new function |
124 | + (geis_delete): new function |
125 | + * testsuite/geis2/Makefile.am (check_geis2_api_SOURCES): added check_geis_new |
126 | + * testsuite/geis2/check_geis2_api.c (main): added geis_new_suite |
127 | + |
128 | +2010-11-21 Stephen M. Webb <stephen.webb@canonical.com> |
129 | + |
130 | + Added test case for geis v2.0 error codes. |
131 | + |
132 | + * include/geis/geis.h: added required v2.0 error codes |
133 | + * testsuite/geis2/check_error_codes.c: new test case |
134 | + * testsuite/geis2/Makefile.am: added new test case |
135 | + * testsuite/geis2/check_geis2_api.c: same |
136 | + |
137 | +2010-11-20 Stephen M. Webb <stephen.webb@canonical.com> |
138 | + |
139 | + Added test case for geis v2.0 basic types. |
140 | + |
141 | + * testsuite/geis2/check_general_types.c: new file |
142 | + * testsuite/geis2/Makefile.am: added above new file |
143 | + * testsuite/geis2/check_geis2_api.c (geis2_general_types_suite_new): added new |
144 | + unit test |
145 | + |
146 | +2010-11-19 Stephen M. Webb <stephen.webb@canonical.com> |
147 | + |
148 | + Added geis v2.0 test hardness and version macro test. |
149 | + |
150 | + * include/geis/geis.h (GEIS_VERSION_2_0): added macro |
151 | + * testsuite/geis2/check_geis_api.c: new testsuite. |
152 | + * testsuite/geis2/check_version_macro.c: added unit test for geis 2.0 version |
153 | + macro |
154 | + * testsuite/geis2/Makefile: new file |
155 | + * configure.ac (AC_OUTPUT): added above enw file |
156 | + * testsuite/Makefile: added new testsuite directory geis2 |
157 | + |
158 | 2010-11-12 Stephen M. Webb <stephen.webb@canonical.com> |
159 | |
160 | Made existing unit test directory specific to geis v1.0. |
161 | |
162 | === modified file 'Makefile.am' |
163 | --- Makefile.am 2010-11-10 14:15:35 +0000 |
164 | +++ Makefile.am 2010-11-24 17:23:10 +0000 |
165 | @@ -5,7 +5,7 @@ |
166 | |
167 | ACLOCAL_MFLAGS = -I m4 |
168 | |
169 | -SUBDIRS = include libutouch-geis-xcb testsuite doc |
170 | +SUBDIRS = include libutouch-geis-xcb libutouch-geis testsuite doc |
171 | |
172 | doc-%: |
173 | $(MAKE) -C doc $@ |
174 | |
175 | === modified file 'configure.ac' |
176 | --- configure.ac 2010-11-12 15:54:32 +0000 |
177 | +++ configure.ac 2010-11-24 17:23:10 +0000 |
178 | @@ -1,6 +1,24 @@ |
179 | # -*- Autoconf -*- |
180 | # Process this file with autoconf to produce a configure script. |
181 | # |
182 | +# |
183 | +# Copyright 2010 Canonical, Ltd. |
184 | +# |
185 | +# This file is part of the utouch-geis library. This library is free software; |
186 | +# you can redistribute it and/or modify it under the terms of the GNU Lesser |
187 | +# General Public License as published by the Free Software Foundation; either |
188 | +# version 3 of the License, or (at your option) any later version. |
189 | +# |
190 | +# This library is distributed in the hope that it will be useful, but WITHOUT |
191 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
192 | +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
193 | +# details. |
194 | +# |
195 | +# You should have received a copy of the GNU Lesser General Public License |
196 | +# along with this program; if not, write to the Free Software Foundation, Inc., |
197 | +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
198 | +# |
199 | + |
200 | AC_PREREQ(2.65) |
201 | AC_INIT([utouch-geis],[1.0.13], |
202 | [stephen.webb@canonical.com],, |
203 | @@ -67,7 +85,10 @@ |
204 | include/Makefile |
205 | libutouch-geis-xcb/Makefile |
206 | libutouch-geis-xcb/xcb_gesture.xml |
207 | + libutouch-geis/Makefile |
208 | testsuite/Makefile |
209 | + testsuite/libutouch-geis/Makefile |
210 | testsuite/geis1/Makefile |
211 | + testsuite/geis2/Makefile |
212 | testsuite/geistest/Makefile]) |
213 | AC_OUTPUT |
214 | |
215 | === modified file 'include/geis/geis.h' |
216 | --- include/geis/geis.h 2010-09-28 18:36:37 +0000 |
217 | +++ include/geis/geis.h 2010-11-24 17:23:10 +0000 |
218 | @@ -25,6 +25,7 @@ |
219 | #endif |
220 | |
221 | #define GEIS_VERSION_1_0 1 |
222 | +#define GEIS_VERSION_2_0 20101122 |
223 | |
224 | #include <geis/geisimpl.h> |
225 | |
226 | @@ -99,6 +100,11 @@ |
227 | #define GEIS_GESTURE_ATTRIBUTE_TOUCH_4_X "touch 4 x" |
228 | #define GEIS_GESTURE_ATTRIBUTE_TOUCH_4_Y "touch 4 y" |
229 | |
230 | + |
231 | +#define GEIS_FALSE 0 |
232 | +#define GEIS_TRUE 1 |
233 | + |
234 | + |
235 | /** |
236 | * @defgroup geis_status Status and Errors |
237 | * |
238 | @@ -116,7 +122,9 @@ |
239 | GEIS_STATUS_SUCCESS = 0, /**< normal successful completion */ |
240 | GEIS_STATUS_NOT_SUPPORTED = 10, /**< a requested feature is not supported */ |
241 | GEIS_BAD_ARGUMENT = 1000, /**< a bad argument value was passed */ |
242 | - GEIS_UNKNOWN_ERROR = 9999 /**< any other error condition */ |
243 | + GEIS_UNKNOWN_ERROR = 9999, /**< any other error condition */ |
244 | + GEIS_STATUS_BAD_ARGUMENT = -100, /**< a bad argument value was passed */ |
245 | + GEIS_STATUS_UNKNOWN_ERROR = -999 /**< any other error condition */ |
246 | } GeisStatus; |
247 | |
248 | /* @} */ |
249 | @@ -182,6 +190,83 @@ |
250 | /* @} */ |
251 | |
252 | /** |
253 | + * @defgroup geis_2_geis The Geis API Object |
254 | + * |
255 | + * @{ |
256 | + */ |
257 | + |
258 | +#define GEIS_INIT_SERVICE_PROVIDER "geis-init-server" |
259 | + |
260 | + |
261 | +typedef struct _Geis *Geis; |
262 | + |
263 | +/** |
264 | + * Initializes an instance of the GEIS v2.0 API. |
265 | + * |
266 | + * @param[in] name A name for the API instance (used for diagnostics). |
267 | + * @param[in] ... A set of zero or more initialization arguments. |
268 | + */ |
269 | +GEIS_API Geis geis_new(GeisString init_arg_name, ...); |
270 | + |
271 | +/** |
272 | + * Cleans up an instance of the GEIS v2.0 API. |
273 | + * |
274 | + * @param[in] geis An instance of the GEIS v2.0 API. |
275 | + * |
276 | + * Tears down the instance of the API and releases any resources associated with |
277 | + * that instance. |
278 | + */ |
279 | +GEIS_API GeisStatus geis_delete(Geis geis); |
280 | + |
281 | +/* @} */ |
282 | + |
283 | +/** |
284 | + * @defgroup geis_error Error Reporting |
285 | + * @{ |
286 | + */ |
287 | + |
288 | +/** |
289 | + * Gets the number of status codes in the error stack. |
290 | + * |
291 | + * @param[in] geis A GEIS API instance or NULL for the global stack |
292 | + * |
293 | + * This function is used primarily to determine the failure details of a GEIS |
294 | + * function that does not explicitly return a GeisStatus value. This is |
295 | + * required for _new() fucntions that return NULL to indicate failure. If the |
296 | + * call to geis_new() itself fails and returns a NULL, the global error stack |
297 | + * must be used, otherwise the API instance error stack must be used. |
298 | + * |
299 | + * The error stack is reset on each GEIS API call, so failure reasons should be |
300 | + * determined immmediately after a GEIS API call. |
301 | + */ |
302 | +GEIS_API GeisSize geis_error_count(Geis geis); |
303 | + |
304 | +/** |
305 | + * Gets the indicated status code from the error stack. |
306 | + * |
307 | + * @param[in] geis A GEIS API instance or NULL for the global stack |
308 | + * @param[in] index Indicates the status value to retrieve. Valid status values |
309 | + * are between 0 and less than the value returned from |
310 | + * geis_error_count() otherwise GEIS_STATUS_BAD_ARGUMENT will |
311 | + * be returned. |
312 | + */ |
313 | +GEIS_API GeisStatus geis_error_code(Geis geis, GeisSize index); |
314 | + |
315 | +/** |
316 | + * Gets the localized error message, if any, associated with the indicated |
317 | + * error. |
318 | + * |
319 | + * @param[in] geis A GEIS API instance or NULL for the global stack |
320 | + * @param[in] index Indicates the status value to retrieve. Valid status values |
321 | + * are between 0 and less than the value returned from |
322 | + * geis_error_count() otherwise GEIS_STATUS_BAD_ARGUMENT will |
323 | + * be returned. |
324 | + */ |
325 | +GEIS_API GeisString geis_error_message(Geis geis, GeisSize index); |
326 | + |
327 | +/* @} */ |
328 | + |
329 | +/** |
330 | * @defgroup geis_config Configuration and Control |
331 | * @{ |
332 | */ |
333 | |
334 | === added directory 'libutouch-geis' |
335 | === modified file 'libutouch-geis-xcb/Makefile.am' |
336 | --- libutouch-geis-xcb/Makefile.am 2010-11-10 14:15:35 +0000 |
337 | +++ libutouch-geis-xcb/Makefile.am 2010-11-24 17:23:10 +0000 |
338 | @@ -8,15 +8,12 @@ |
339 | # work around a problem with XCB tools |
340 | XCB_CFLAGS += -I$(includedir)/xcb -I$(XCBINCLUDEDIR)/xcb |
341 | |
342 | -version_script = $(srcdir)/libutouch-geis-xcb.ver |
343 | - |
344 | dist_inc_HEADERS = geis/geisimpl.h |
345 | |
346 | -lib_LTLIBRARIES = libutouch-geis.la |
347 | +noinst_LTLIBRARIES = libutouch-geis.la |
348 | |
349 | libutouch_geis_la_SOURCES = \ |
350 | geis.c \ |
351 | - geis_logging.h geis_logging.c \ |
352 | geis_instance.h geis_instance.c \ |
353 | geis_instance_table.h geis_instance_table.c \ |
354 | geis_xcb.h geis_xcb.c |
355 | @@ -30,15 +27,13 @@ |
356 | -DGEIS_BUILDING_DSO=1 \ |
357 | -I$(top_srcdir) \ |
358 | -I$(top_srcdir)/include \ |
359 | + -I$(top_srcdir)/libutouch-geis \ |
360 | $(GRAIL_CFLAGS) \ |
361 | $(X11XCB_CFLAGS) \ |
362 | $(XCB_CFLAGS) \ |
363 | $(XI2_CFLAGS) |
364 | |
365 | -libutouch_geis_la_LDFLAGS = \ |
366 | - -Wl,-z,defs -Wl,--as-needed \ |
367 | - -version-info 1:2:0 \ |
368 | - -Wl,--version-script=$(version_script) |
369 | +libutouch_geis_la_LDFLAGS = |
370 | |
371 | libutouch_geis_la_LIBADD = \ |
372 | $(X11XCB_LIBS) \ |
373 | @@ -52,5 +47,5 @@ |
374 | $(dist_libutouch_geis_la_SOURCES): $(xcbproto_tools) |
375 | $(PYTHON) $(srcdir)/c_client.py -p $(XCBPROTO_XCBPYTHONDIR) $(builddir)/$< |
376 | |
377 | -EXTRA_DIST = $(xcbproto_tools) $(version_script) |
378 | +EXTRA_DIST = $(xcbproto_tools) |
379 | |
380 | |
381 | === removed file 'libutouch-geis-xcb/libutouch-geis-xcb.ver' |
382 | --- libutouch-geis-xcb/libutouch-geis-xcb.ver 2010-08-12 15:43:49 +0000 |
383 | +++ libutouch-geis-xcb/libutouch-geis-xcb.ver 1970-01-01 00:00:00 +0000 |
384 | @@ -1,15 +0,0 @@ |
385 | -GEIS_1.0 { |
386 | - global: |
387 | - geis_configuration_get_value; |
388 | - geis_configuration_set_value; |
389 | - geis_configuration_supported; |
390 | - geis_event_dispatch; |
391 | - geis_finish; |
392 | - geis_init; |
393 | - geis_input_devices; |
394 | - geis_subscribe; |
395 | - geis_unsubscribe; |
396 | - |
397 | - local: |
398 | - *; |
399 | -}; |
400 | |
401 | === added file 'libutouch-geis/Makefile.am' |
402 | --- libutouch-geis/Makefile.am 1970-01-01 00:00:00 +0000 |
403 | +++ libutouch-geis/Makefile.am 2010-11-24 17:23:10 +0000 |
404 | @@ -0,0 +1,47 @@ |
405 | +# |
406 | +# @file libutouch-geis/Makefile.am |
407 | +# @brief automake recipe for the uTouch GEIS v2.0 implementation |
408 | +# |
409 | +# Copyright 2010 Canonical, Ltd. |
410 | +# |
411 | +# This file is part of the utouch-geis library. This library is free software; |
412 | +# you can redistribute it and/or modify it under the terms of the GNU Lesser |
413 | +# General Public License as published by the Free Software Foundation; either |
414 | +# version 3 of the License, or (at your option) any later version. |
415 | +# |
416 | +# This library is distributed in the hope that it will be useful, but WITHOUT |
417 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
418 | +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
419 | +# details. |
420 | +# |
421 | +# You should have received a copy of the GNU Lesser General Public License |
422 | +# along with this program; if not, write to the Free Software Foundation, Inc., |
423 | +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
424 | +# |
425 | +version_script = $(srcdir)/libutouch-geis.ver |
426 | + |
427 | +lib_LTLIBRARIES = libutouch-geis.la |
428 | + |
429 | +libutouch_geis_la_SOURCES = \ |
430 | + geis_error.h geis_error.c \ |
431 | + geis_logging.h geis_logging.c \ |
432 | + geis_private.h geis.c |
433 | + |
434 | +libutouch_geis_la_CPPFLAGS = \ |
435 | + -Wall -Wextra \ |
436 | + -fvisibility=hidden \ |
437 | + -DGEIS_BUILDING_DSO=1 \ |
438 | + -I$(top_srcdir) \ |
439 | + -I$(top_srcdir)/include \ |
440 | + $(GRAIL_CFLAGS) |
441 | + |
442 | +libutouch_geis_la_LDFLAGS = \ |
443 | + -Wl,-z,defs -Wl,--as-needed \ |
444 | + -version-info 2:0:1 \ |
445 | + -Wl,--version-script=$(version_script) |
446 | + |
447 | +libutouch_geis_la_LIBADD = \ |
448 | + $(top_builddir)/libutouch-geis-xcb/libutouch-geis.la |
449 | + |
450 | +EXTRA_DIST = $(version_script) |
451 | + |
452 | |
453 | === added file 'libutouch-geis/geis.c' |
454 | --- libutouch-geis/geis.c 1970-01-01 00:00:00 +0000 |
455 | +++ libutouch-geis/geis.c 2010-11-24 17:23:10 +0000 |
456 | @@ -0,0 +1,104 @@ |
457 | +/** |
458 | + * @file libutouch-geis/geis.c |
459 | + * @brief implementation of the uTouch GEIS v2.0 API instance |
460 | + * |
461 | + * Copyright 2010 Canonical Ltd. |
462 | + * |
463 | + * This library is free software; you can redistribute it and/or modify it under |
464 | + * the terms of the GNU Lesser General Public License as published by the Free |
465 | + * Software Foundation; either version 3 of the License, or (at your option) any |
466 | + * later version. |
467 | + * |
468 | + * This library is distributed in the hope that it will be useful, but WITHOUT |
469 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
470 | + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
471 | + * details. |
472 | + * |
473 | + * You should have received a copy of the GNU Lesser General Public License |
474 | + * along with this program; if not, write to the Free Software Foundation, Inc., |
475 | + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
476 | + */ |
477 | +#include "geis_config.h" |
478 | +#include "geis_private.h" |
479 | + |
480 | +#include "geis_error.h" |
481 | +#include "geis_logging.h" |
482 | +#include <stdarg.h> |
483 | + |
484 | + |
485 | + |
486 | +/** |
487 | + * Creates a new empty Geis API instance. |
488 | + */ |
489 | +static Geis |
490 | +geis_new_empty() |
491 | +{ |
492 | + geis_error_clear(NULL); |
493 | + Geis geis = calloc(1, sizeof(struct _Geis)); |
494 | + if (!geis) |
495 | + { |
496 | + geis_error_push(NULL, GEIS_STATUS_UNKNOWN_ERROR); |
497 | + geis_error("calloc failed"); |
498 | + } |
499 | + return geis; |
500 | +} |
501 | + |
502 | + |
503 | +/** |
504 | + * Sets optional parts of a Geis API instance from a variable argument list. |
505 | + */ |
506 | +static void |
507 | +geis_set_valist(Geis geis, GeisString init_arg_name, va_list varargs) |
508 | +{ |
509 | + while (init_arg_name) |
510 | + { |
511 | + if (0 == strcmp(init_arg_name, GEIS_INIT_SERVICE_PROVIDER)) |
512 | + { |
513 | + geis_debug("initializing GEIS server"); |
514 | + } |
515 | + else if (0 == strcmp(init_arg_name, "geis-test-fixture")) |
516 | + { |
517 | + geis_debug("initializing GEIS test fixture"); |
518 | + geis->is_test_fixture = GEIS_TRUE; |
519 | + } |
520 | + |
521 | + init_arg_name = va_arg(varargs, GeisString); |
522 | + } |
523 | +} |
524 | + |
525 | + |
526 | +/** |
527 | + * Creates an initialized Geis API instance. |
528 | + */ |
529 | +Geis |
530 | +geis_new(GeisString init_arg_name, ...) |
531 | +{ |
532 | + Geis geis = geis_new_empty(); |
533 | + if (geis) |
534 | + { |
535 | + va_list varargs; |
536 | + va_start(varargs, init_arg_name); |
537 | + geis_set_valist(geis, init_arg_name, varargs); |
538 | + va_end(varargs); |
539 | + } |
540 | + |
541 | + return geis; |
542 | +} |
543 | + |
544 | + |
545 | +/** |
546 | + * Disposes of a Geis API instance. |
547 | + */ |
548 | +GeisStatus |
549 | +geis_delete(Geis geis) |
550 | +{ |
551 | + if (geis == NULL) |
552 | + { |
553 | + return GEIS_STATUS_BAD_ARGUMENT; |
554 | + } |
555 | + free(geis); |
556 | + return GEIS_STATUS_SUCCESS; |
557 | +} |
558 | + |
559 | + |
560 | + |
561 | |
562 | === added file 'libutouch-geis/geis_error.c' |
563 | --- libutouch-geis/geis_error.c 1970-01-01 00:00:00 +0000 |
564 | +++ libutouch-geis/geis_error.c 2010-11-24 17:23:10 +0000 |
565 | @@ -0,0 +1,143 @@ |
566 | +/** |
567 | + * @file libutouch-geis/geis_error.c |
568 | + * @brief implementation of the uTouch GEIS v2.0 API error reporting module |
569 | + * |
570 | + * Copyright 2010 Canonical Ltd. |
571 | + * |
572 | + * This library is free software; you can redistribute it and/or modify it under |
573 | + * the terms of the GNU Lesser General Public License as published by the Free |
574 | + * Software Foundation; either version 3 of the License, or (at your option) any |
575 | + * later version. |
576 | + * |
577 | + * This library is distributed in the hope that it will be useful, but WITHOUT |
578 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
579 | + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
580 | + * details. |
581 | + * |
582 | + * You should have received a copy of the GNU Lesser General Public License |
583 | + * along with this program; if not, write to the Free Software Foundation, Inc., |
584 | + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
585 | + */ |
586 | +#include "geis_config.h" |
587 | +#include "geis_error.h" |
588 | + |
589 | +#include "geis_logging.h" |
590 | +#include "geis_private.h" |
591 | +#include <stdlib.h> |
592 | + |
593 | + |
594 | +static GeisErrorStack g_error_stack = { 0, 0, 0 }; |
595 | + |
596 | + |
597 | +static void |
598 | +geis_error_stack_clear(GeisErrorStack *error_stack) |
599 | +{ |
600 | + error_stack->error_count = 0; |
601 | +} |
602 | + |
603 | + |
604 | +static void |
605 | +geis_error_stack_push(GeisErrorStack *error_stack, GeisStatus code) |
606 | +{ |
607 | + if (error_stack->error_count < error_stack->store_size) |
608 | + { |
609 | + error_stack->store[++error_stack->error_count] = code; |
610 | + } |
611 | + else |
612 | + { |
613 | + error_stack->store_size += 2; |
614 | + error_stack->store = realloc(error_stack->store, error_stack->store_size); |
615 | + if (!error_stack->store) |
616 | + { |
617 | + geis_error("error_stack realloc failed for size %d", |
618 | + error_stack->store_size); |
619 | + return; |
620 | + } |
621 | + error_stack->store[++error_stack->error_count] = code; |
622 | + } |
623 | +} |
624 | + |
625 | + |
626 | +static GeisStatus |
627 | +geis_error_stack_get(GeisErrorStack *error_stack, GeisSize index) |
628 | +{ |
629 | + if (index < error_stack->error_count) |
630 | + { |
631 | + return error_stack->store[index]; |
632 | + } |
633 | + return GEIS_STATUS_BAD_ARGUMENT; |
634 | +} |
635 | + |
636 | + |
637 | +void |
638 | +geis_error_clear(Geis geis) |
639 | +{ |
640 | + if (geis) |
641 | + { |
642 | + geis_error_stack_clear(&geis->error_stack); |
643 | + } |
644 | + else |
645 | + { |
646 | + geis_error_stack_clear(&g_error_stack); |
647 | + } |
648 | +} |
649 | + |
650 | + |
651 | +void |
652 | +geis_error_push(Geis geis, GeisStatus code) |
653 | +{ |
654 | + if (geis) |
655 | + { |
656 | + geis_error_stack_push(&geis->error_stack, code); |
657 | + } |
658 | + else |
659 | + { |
660 | + geis_error_stack_push(&g_error_stack, code); |
661 | + } |
662 | +} |
663 | + |
664 | + |
665 | +GeisSize |
666 | +geis_error_count(Geis geis) |
667 | +{ |
668 | + if (geis) |
669 | + { |
670 | + return geis->error_stack.error_count; |
671 | + } |
672 | + else |
673 | + { |
674 | + return g_error_stack.error_count; |
675 | + } |
676 | +} |
677 | + |
678 | + |
679 | +GeisStatus |
680 | +geis_error_code(Geis geis, GeisSize index) |
681 | +{ |
682 | + GeisStatus status = GEIS_STATUS_UNKNOWN_ERROR; |
683 | + if (geis) |
684 | + { |
685 | + status = geis_error_stack_get(&geis->error_stack, index); |
686 | + } |
687 | + else |
688 | + { |
689 | + status = geis_error_stack_get(&g_error_stack, index); |
690 | + } |
691 | + return status; |
692 | +} |
693 | + |
694 | + |
695 | +GeisString |
696 | +geis_error_message(Geis geis, GeisSize index) |
697 | +{ |
698 | + GeisString message = ""; |
699 | + if (geis) |
700 | + { |
701 | + } |
702 | + else |
703 | + { |
704 | + } |
705 | + return message; |
706 | +} |
707 | + |
708 | + |
709 | |
710 | === added file 'libutouch-geis/geis_error.h' |
711 | --- libutouch-geis/geis_error.h 1970-01-01 00:00:00 +0000 |
712 | +++ libutouch-geis/geis_error.h 2010-11-24 17:23:10 +0000 |
713 | @@ -0,0 +1,42 @@ |
714 | +/** |
715 | + * @file geis_error.h |
716 | + * @brief internal GEIS error facilities |
717 | + * |
718 | + * Copyright 2010 Canonical Ltd. |
719 | + * |
720 | + * This library is free software; you can redistribute it and/or modify it under |
721 | + * the terms of the GNU Lesser General Public License as published by the Free |
722 | + * Software Foundation; either version 3 of the License, or (at your option) any |
723 | + * later version. |
724 | + * |
725 | + * This library is distributed in the hope that it will be useful, but WITHOUT |
726 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
727 | + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
728 | + * details. |
729 | + * |
730 | + * You should have received a copy of the GNU Lesser General Public License |
731 | + * along with this program; if not, write to the Free Software Foundation, Inc., |
732 | + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
733 | + */ |
734 | +#ifndef GEIS_ERROR_H_ |
735 | +#define GEIS_ERROR_H_ |
736 | + |
737 | +#include <geis/geis.h> |
738 | + |
739 | + |
740 | +/* |
741 | + * A structure to hold the error stack |
742 | + */ |
743 | +typedef struct _GeisErrorStack |
744 | +{ |
745 | + GeisStatus *store; |
746 | + GeisSize store_size; |
747 | + GeisSize error_count; |
748 | +} GeisErrorStack; |
749 | + |
750 | + |
751 | +void geis_error_clear(Geis geis); |
752 | + |
753 | +void geis_error_push(Geis geis, GeisStatus code); |
754 | + |
755 | +#endif /* GEIS_ERROR_H_ */ |
756 | |
757 | === renamed file 'libutouch-geis-xcb/geis_logging.c' => 'libutouch-geis/geis_logging.c' |
758 | === renamed file 'libutouch-geis-xcb/geis_logging.h' => 'libutouch-geis/geis_logging.h' |
759 | === added file 'libutouch-geis/geis_private.h' |
760 | --- libutouch-geis/geis_private.h 1970-01-01 00:00:00 +0000 |
761 | +++ libutouch-geis/geis_private.h 2010-11-24 17:23:10 +0000 |
762 | @@ -0,0 +1,36 @@ |
763 | +/** |
764 | + * @file geis_error.h |
765 | + * @brief internal GEIS error facilities |
766 | + * |
767 | + * Copyright 2010 Canonical Ltd. |
768 | + * |
769 | + * This library is free software; you can redistribute it and/or modify it under |
770 | + * the terms of the GNU Lesser General Public License as published by the Free |
771 | + * Software Foundation; either version 3 of the License, or (at your option) any |
772 | + * later version. |
773 | + * |
774 | + * This library is distributed in the hope that it will be useful, but WITHOUT |
775 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
776 | + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
777 | + * details. |
778 | + * |
779 | + * You should have received a copy of the GNU Lesser General Public License |
780 | + * along with this program; if not, write to the Free Software Foundation, Inc., |
781 | + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
782 | + */ |
783 | +#ifndef GEIS_PRIVATE_H_ |
784 | +#define GEIS_PRIVATE_H_ |
785 | + |
786 | +#include <geis/geis.h> |
787 | + |
788 | +#include "geis_error.h" |
789 | + |
790 | + |
791 | +struct _Geis |
792 | +{ |
793 | + GeisBoolean is_test_fixture; |
794 | + GeisErrorStack error_stack; |
795 | +}; |
796 | + |
797 | + |
798 | +#endif /* GEIS_PRIVATE_H_ */ |
799 | |
800 | === added file 'libutouch-geis/libutouch-geis.ver' |
801 | --- libutouch-geis/libutouch-geis.ver 1970-01-01 00:00:00 +0000 |
802 | +++ libutouch-geis/libutouch-geis.ver 2010-11-24 17:23:10 +0000 |
803 | @@ -0,0 +1,24 @@ |
804 | +GEIS_1.0 { |
805 | + global: |
806 | + geis_configuration_get_value; |
807 | + geis_configuration_set_value; |
808 | + geis_configuration_supported; |
809 | + geis_event_dispatch; |
810 | + geis_finish; |
811 | + geis_init; |
812 | + geis_input_devices; |
813 | + geis_subscribe; |
814 | + geis_unsubscribe; |
815 | +}; |
816 | + |
817 | +GEIS_2.0 { |
818 | + global: |
819 | + geis_delete; |
820 | + geis_error_count; |
821 | + geis_error_code; |
822 | + geis_error_message; |
823 | + geis_new; |
824 | + |
825 | + local: |
826 | + *; |
827 | +}; |
828 | |
829 | === modified file 'testsuite/Makefile.am' |
830 | --- testsuite/Makefile.am 2010-11-12 15:54:32 +0000 |
831 | +++ testsuite/Makefile.am 2010-11-24 17:23:10 +0000 |
832 | @@ -1,1 +1,24 @@ |
833 | -SUBDIRS = geis1 geistest |
834 | +# |
835 | +# @file testsuite/Makefile.am |
836 | +# @brief automake recipe for the GEIS test suite |
837 | +# |
838 | +# |
839 | +# Copyright 2010 Canonical, Ltd. |
840 | +# |
841 | +# This file is part of the utouch-geis library. This library is free software; |
842 | +# you can redistribute it and/or modify it under the terms of the GNU Lesser |
843 | +# General Public License as published by the Free Software Foundation; either |
844 | +# version 3 of the License, or (at your option) any later version. |
845 | +# |
846 | +# This library is distributed in the hope that it will be useful, but WITHOUT |
847 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
848 | +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
849 | +# details. |
850 | +# |
851 | +# You should have received a copy of the GNU Lesser General Public License |
852 | +# along with this program; if not, write to the Free Software Foundation, Inc., |
853 | +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
854 | +# |
855 | + |
856 | +SUBDIRS = libutouch-geis geis1 geis2 geistest |
857 | + |
858 | |
859 | === modified file 'testsuite/geis1/Makefile.am' |
860 | --- testsuite/geis1/Makefile.am 2010-11-12 15:54:32 +0000 |
861 | +++ testsuite/geis1/Makefile.am 2010-11-24 17:23:10 +0000 |
862 | @@ -26,7 +26,7 @@ |
863 | $(CHECK_CFLAGS) |
864 | |
865 | check_geis_internals_LDADD = \ |
866 | - $(top_builddir)/libutouch-geis-xcb/.libs/libutouch-geis.a \ |
867 | + $(top_builddir)/libutouch-geis/.libs/libutouch-geis.a \ |
868 | $(X11XCB_LIBS) \ |
869 | $(XCB_LIBS) \ |
870 | $(XI2_LIBS) \ |
871 | |
872 | === modified file 'testsuite/geis1/check_geis_internals.c' |
873 | --- testsuite/geis1/check_geis_internals.c 2010-10-20 17:35:47 +0000 |
874 | +++ testsuite/geis1/check_geis_internals.c 2010-11-24 17:23:10 +0000 |
875 | @@ -11,7 +11,7 @@ |
876 | { |
877 | int num_failed = 0; |
878 | |
879 | - Suite *s = suite_create("\"geis internals\""); |
880 | + Suite *s = suite_create("\"uTouch GEIS v1.0 internals\""); |
881 | |
882 | SRunner *sr = srunner_create(s); |
883 | srunner_add_suite(sr, make_instance_table_suite()); |
884 | |
885 | === added directory 'testsuite/geis2' |
886 | === added file 'testsuite/geis2/Makefile.am' |
887 | --- testsuite/geis2/Makefile.am 1970-01-01 00:00:00 +0000 |
888 | +++ testsuite/geis2/Makefile.am 2010-11-24 17:23:10 +0000 |
889 | @@ -0,0 +1,36 @@ |
890 | +# |
891 | +# @file testsuite/geis1/Makefile.am |
892 | +# @brief automake recipe for the geis v1.0 testsuite unit testing directory |
893 | +# |
894 | + |
895 | +if HAVE_CHECK |
896 | + test_targets = check_geis2_api |
897 | +else |
898 | + test_targets = |
899 | +endif |
900 | + |
901 | +TESTS = $(test_targets) |
902 | + |
903 | +check_PROGRAMS = $(test_targets) |
904 | + |
905 | +check_geis2_api_SOURCES = \ |
906 | + check_error_codes.c \ |
907 | + check_geis_new.c \ |
908 | + check_general_types.c \ |
909 | + check_version_macro.c \ |
910 | + check_geis2_api.c |
911 | + |
912 | +check_geis2_api_CFLAGS = \ |
913 | + -I$(top_srcdir) \ |
914 | + -I$(top_srcdir)/include \ |
915 | + $(CHECK_CFLAGS) |
916 | + |
917 | +check_geis2_api_LDADD = \ |
918 | + $(top_builddir)/libutouch-geis/libutouch-geis.la \ |
919 | + $(X11XCB_LIBS) \ |
920 | + $(XCB_LIBS) \ |
921 | + $(XI2_LIBS) \ |
922 | + $(CHECK_LIBS) |
923 | + |
924 | +MOSTLYCLEANFILES = geis2_api.log |
925 | + |
926 | |
927 | === added file 'testsuite/geis2/check_error_codes.c' |
928 | --- testsuite/geis2/check_error_codes.c 1970-01-01 00:00:00 +0000 |
929 | +++ testsuite/geis2/check_error_codes.c 2010-11-24 17:23:10 +0000 |
930 | @@ -0,0 +1,31 @@ |
931 | +/** |
932 | + * unit tests for GEIS v2.0 error codes |
933 | + */ |
934 | +#include <check.h> |
935 | + |
936 | +#include <geis/geis.h> |
937 | + |
938 | +/* compile-time test to ensure required types are defined */ |
939 | +START_TEST(error_codes) |
940 | +{ |
941 | + GeisStatus error = GEIS_STATUS_SUCCESS ; |
942 | + error = GEIS_STATUS_NOT_SUPPORTED; |
943 | + error = GEIS_STATUS_BAD_ARGUMENT; |
944 | + error = GEIS_STATUS_UNKNOWN_ERROR; |
945 | +} |
946 | +END_TEST |
947 | + |
948 | + |
949 | +/* boilerplate */ |
950 | +Suite * |
951 | +geis2_error_codes_suite_new() |
952 | +{ |
953 | + Suite *s = suite_create("geis2_error_codes"); |
954 | + |
955 | + TCase *create = tcase_create("error_codes"); |
956 | + tcase_add_test(create, error_codes); |
957 | + suite_add_tcase(s, create); |
958 | + |
959 | + return s; |
960 | +} |
961 | + |
962 | |
963 | === added file 'testsuite/geis2/check_geis2_api.c' |
964 | --- testsuite/geis2/check_geis2_api.c 1970-01-01 00:00:00 +0000 |
965 | +++ testsuite/geis2/check_geis2_api.c 2010-11-24 17:23:10 +0000 |
966 | @@ -0,0 +1,32 @@ |
967 | +/** |
968 | + * test driver for unit testing of geis internals |
969 | + */ |
970 | +#include <check.h> |
971 | + |
972 | + |
973 | +extern Suite *make_version_macro_suite(); |
974 | +extern Suite *geis2_general_types_suite_new(); |
975 | +extern Suite *geis2_error_codes_suite_new(); |
976 | +extern Suite *geis2_geis_new_suite_new(); |
977 | + |
978 | +int |
979 | +main(int argc, char* argv[]) |
980 | +{ |
981 | + int num_failed = 0; |
982 | + |
983 | + Suite *s = suite_create("\"GEIS v2.0 API\""); |
984 | + |
985 | + SRunner *sr = srunner_create(s); |
986 | + srunner_add_suite(sr, make_version_macro_suite()); |
987 | + srunner_add_suite(sr, geis2_general_types_suite_new()); |
988 | + srunner_add_suite(sr, geis2_error_codes_suite_new()); |
989 | + srunner_add_suite(sr, geis2_geis_new_suite_new()); |
990 | + |
991 | + srunner_set_log(sr, "geis2_api.log"); |
992 | + srunner_run_all(sr, CK_NORMAL); |
993 | + num_failed = srunner_ntests_failed(sr); |
994 | + |
995 | + srunner_free(sr); |
996 | + |
997 | + return !(num_failed == 0); |
998 | +} |
999 | |
1000 | === added file 'testsuite/geis2/check_geis_new.c' |
1001 | --- testsuite/geis2/check_geis_new.c 1970-01-01 00:00:00 +0000 |
1002 | +++ testsuite/geis2/check_geis_new.c 2010-11-24 17:23:10 +0000 |
1003 | @@ -0,0 +1,32 @@ |
1004 | +/** |
1005 | + * Unit tests for GEIS v2.0 API instance creation. |
1006 | + */ |
1007 | +#include <check.h> |
1008 | + |
1009 | +#include <geis/geis.h> |
1010 | + |
1011 | +/* compile-time test to ensure required types are defined */ |
1012 | +START_TEST(geis_new_and_delete) |
1013 | +{ |
1014 | + Geis geis = geis_new("geis-test-fixture", NULL); |
1015 | + fail_unless(geis != NULL, "failed to create GEIS v2.0 API instance"); |
1016 | + |
1017 | + GeisStatus status = geis_delete(geis); |
1018 | + fail_unless(status == GEIS_STATUS_SUCCESS, "geis_delete failed"); |
1019 | +} |
1020 | +END_TEST |
1021 | + |
1022 | + |
1023 | +/* boilerplate */ |
1024 | +Suite * |
1025 | +geis2_geis_new_suite_new() |
1026 | +{ |
1027 | + Suite *s = suite_create("geis2_geis_new"); |
1028 | + |
1029 | + TCase *create = tcase_create("geis_new_and_delete"); |
1030 | + tcase_add_test(create, geis_new_and_delete); |
1031 | + suite_add_tcase(s, create); |
1032 | + |
1033 | + return s; |
1034 | +} |
1035 | + |
1036 | |
1037 | === added file 'testsuite/geis2/check_general_types.c' |
1038 | --- testsuite/geis2/check_general_types.c 1970-01-01 00:00:00 +0000 |
1039 | +++ testsuite/geis2/check_general_types.c 2010-11-24 17:23:10 +0000 |
1040 | @@ -0,0 +1,32 @@ |
1041 | +/** |
1042 | + * unit tests for the geis_instance_table module |
1043 | + */ |
1044 | +#include <check.h> |
1045 | + |
1046 | +#include <geis/geis.h> |
1047 | + |
1048 | +/* compile-time test to ensure required types are defined */ |
1049 | +START_TEST(general_types) |
1050 | +{ |
1051 | + GeisBoolean geis_boolean; |
1052 | + GeisInteger geis_integer; |
1053 | + GeisFloat geis_float; |
1054 | + GeisSize geis_size; |
1055 | + GeisString geis_string; |
1056 | +} |
1057 | +END_TEST |
1058 | + |
1059 | + |
1060 | +/* boilerplate */ |
1061 | +Suite * |
1062 | +geis2_general_types_suite_new() |
1063 | +{ |
1064 | + Suite *s = suite_create("geis2_general_types"); |
1065 | + |
1066 | + TCase *create = tcase_create("general_types"); |
1067 | + tcase_add_test(create, general_types); |
1068 | + suite_add_tcase(s, create); |
1069 | + |
1070 | + return s; |
1071 | +} |
1072 | + |
1073 | |
1074 | === added file 'testsuite/geis2/check_version_macro.c' |
1075 | --- testsuite/geis2/check_version_macro.c 1970-01-01 00:00:00 +0000 |
1076 | +++ testsuite/geis2/check_version_macro.c 2010-11-24 17:23:10 +0000 |
1077 | @@ -0,0 +1,32 @@ |
1078 | +/** |
1079 | + * unit tests for the geis_instance_table module |
1080 | + */ |
1081 | +#include <check.h> |
1082 | + |
1083 | +#include "geis/geis.h" |
1084 | + |
1085 | + |
1086 | +START_TEST(existence) |
1087 | +{ |
1088 | +#ifdef GEIS_VERSION_2_0 |
1089 | + fail_unless(0==0); |
1090 | +#else |
1091 | + fail_unless(0!=0); |
1092 | +#endif |
1093 | +} |
1094 | +END_TEST |
1095 | + |
1096 | + |
1097 | +/* boilerplate */ |
1098 | +Suite * |
1099 | +make_version_macro_suite() |
1100 | +{ |
1101 | + Suite *s = suite_create("geis_version_macro"); |
1102 | + |
1103 | + TCase *create = tcase_create("existence"); |
1104 | + tcase_add_test(create, existence); |
1105 | + suite_add_tcase(s, create); |
1106 | + |
1107 | + return s; |
1108 | +} |
1109 | + |
1110 | |
1111 | === modified file 'testsuite/geistest/Makefile.am' |
1112 | --- testsuite/geistest/Makefile.am 2010-11-10 14:15:35 +0000 |
1113 | +++ testsuite/geistest/Makefile.am 2010-11-24 17:23:10 +0000 |
1114 | @@ -1,6 +1,4 @@ |
1115 | |
1116 | -geis_impl = xcb |
1117 | - |
1118 | bin_PROGRAMS = geistest |
1119 | |
1120 | geistest_SOURCES = \ |
1121 | @@ -12,4 +10,4 @@ |
1122 | -I$(top_srcdir)/libutouch-geis-$(geis_impl) |
1123 | |
1124 | geistest_LDADD = \ |
1125 | - $(top_builddir)/libutouch-geis-$(geis_impl)/libutouch-geis.la |
1126 | + $(top_builddir)/libutouch-geis/libutouch-geis.la |
1127 | |
1128 | === added directory 'testsuite/libutouch-geis' |
1129 | === added file 'testsuite/libutouch-geis/Makefile.am' |
1130 | --- testsuite/libutouch-geis/Makefile.am 1970-01-01 00:00:00 +0000 |
1131 | +++ testsuite/libutouch-geis/Makefile.am 2010-11-24 17:23:10 +0000 |
1132 | @@ -0,0 +1,53 @@ |
1133 | +# |
1134 | +# @file testsuite/libutouch-geis/Makefile.am |
1135 | +# @brief automake recipe for the uTouch GEIS v2.0 internals unit test suite |
1136 | +# |
1137 | +# |
1138 | +# Copyright 2010 Canonical, Ltd. |
1139 | +# |
1140 | +# This file is part of the utouch-geis library. This library is free software; |
1141 | +# you can redistribute it and/or modify it under the terms of the GNU Lesser |
1142 | +# General Public License as published by the Free Software Foundation; either |
1143 | +# version 3 of the License, or (at your option) any later version. |
1144 | +# |
1145 | +# This library is distributed in the hope that it will be useful, but WITHOUT |
1146 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
1147 | +# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
1148 | +# details. |
1149 | +# |
1150 | +# You should have received a copy of the GNU Lesser General Public License |
1151 | +# along with this program; if not, write to the Free Software Foundation, Inc., |
1152 | +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1153 | +# |
1154 | + |
1155 | +if HAVE_CHECK |
1156 | + test_targets = check_geis2_internals |
1157 | +else |
1158 | + test_targets = |
1159 | +endif |
1160 | + |
1161 | +TESTS = $(test_targets) |
1162 | + |
1163 | +check_PROGRAMS = $(test_targets) |
1164 | + |
1165 | +check_geis2_internals_SOURCES = \ |
1166 | + check_error_reporting.c \ |
1167 | + check_geis2_internals.c |
1168 | + |
1169 | +check_geis2_internals_CFLAGS = \ |
1170 | + -I$(top_srcdir) \ |
1171 | + -I$(top_srcdir)/include \ |
1172 | + $(CHECK_CFLAGS) |
1173 | + |
1174 | +# |
1175 | +# Link against the (non-distributed) static libutouch-geis to pick up the |
1176 | +# internal symbols. |
1177 | +# |
1178 | +check_geis2_internals_LDADD = \ |
1179 | + $(top_builddir)/libutouch-geis/.libs/libutouch-geis.a \ |
1180 | + $(CHECK_LIBS) |
1181 | + |
1182 | +MOSTLYCLEANFILES = \ |
1183 | + geis2_internals.log \ |
1184 | + geis2_internals.xml |
1185 | + |
1186 | |
1187 | === added file 'testsuite/libutouch-geis/check_error_reporting.c' |
1188 | --- testsuite/libutouch-geis/check_error_reporting.c 1970-01-01 00:00:00 +0000 |
1189 | +++ testsuite/libutouch-geis/check_error_reporting.c 2010-11-24 17:23:10 +0000 |
1190 | @@ -0,0 +1,39 @@ |
1191 | +/** |
1192 | + * unit tests for the geis_instance_table module |
1193 | + */ |
1194 | +#include <check.h> |
1195 | + |
1196 | +#include "geis/geis.h" |
1197 | +#include "libutouch-geis/geis_error.h" |
1198 | + |
1199 | + |
1200 | +START_TEST(global_error_stack) |
1201 | +{ |
1202 | + int i = 0; |
1203 | + |
1204 | + geis_error_clear(NULL); |
1205 | + geis_error_push(NULL, GEIS_STATUS_SUCCESS); |
1206 | + |
1207 | + fail_unless(geis_error_count(NULL) == 1, "unexpected error stack size"); |
1208 | + for (i=0; i < geis_error_count(NULL); ++i) |
1209 | + { |
1210 | + fail_unless(geis_error_code(NULL, i) == GEIS_STATUS_SUCCESS, |
1211 | + "unexpected status code retrieved"); |
1212 | + } |
1213 | +} |
1214 | +END_TEST |
1215 | + |
1216 | + |
1217 | +/* boilerplate */ |
1218 | +Suite * |
1219 | +make_error_reporting_suite() |
1220 | +{ |
1221 | + Suite *s = suite_create("geis2-error-reporting"); |
1222 | + |
1223 | + TCase *create = tcase_create("error-reporting"); |
1224 | + tcase_add_test(create, global_error_stack); |
1225 | + suite_add_tcase(s, create); |
1226 | + |
1227 | + return s; |
1228 | +} |
1229 | + |
1230 | |
1231 | === added file 'testsuite/libutouch-geis/check_geis2_internals.c' |
1232 | --- testsuite/libutouch-geis/check_geis2_internals.c 1970-01-01 00:00:00 +0000 |
1233 | +++ testsuite/libutouch-geis/check_geis2_internals.c 2010-11-24 17:23:10 +0000 |
1234 | @@ -0,0 +1,26 @@ |
1235 | +/** |
1236 | + * test driver for unit testing of uTouch geis v2.0 internals |
1237 | + */ |
1238 | +#include <check.h> |
1239 | + |
1240 | +extern Suite *make_error_reporting_suite(); |
1241 | + |
1242 | + |
1243 | +int |
1244 | +main(int argc, char* argv[]) |
1245 | +{ |
1246 | + int num_failed = 0; |
1247 | + |
1248 | + Suite *s = suite_create("\"uTouch GEIS v2.0 internals\""); |
1249 | + |
1250 | + SRunner *sr = srunner_create(s); |
1251 | + srunner_add_suite(sr, make_error_reporting_suite()); |
1252 | + |
1253 | + srunner_set_log(sr, "geis2_internals.log"); |
1254 | + srunner_run_all(sr, CK_NORMAL); |
1255 | + num_failed = srunner_ntests_failed(sr); |
1256 | + |
1257 | + srunner_free(sr); |
1258 | + |
1259 | + return !(num_failed == 0); |
1260 | +} |
1. Would it make sense to define GEIS_VERSION_2_0 as a negative number until its released? I'm just wondering what it will look like if someone is depending on it. They'll have to check if it's value is less than some huge number (i.e. 20101122) if they want to be sure it's an official release.
2. I didn't see a #define for the global error stack. Something like "#define GEIS_GLOBAL_ERR NULL" might be helpful.
I didn't go through this with a fine tooth comb, but everything else looks good to me. I'm approving it as is, you can decide to make changes for the above comments as you see fit. They aren't show stoppers :).