Commit Graph

52 Commits

Author SHA1 Message Date
Matthias Clasen
43806fca69 settings: Improve test coverage 2012-04-08 10:24:51 -04:00
Ryan Lortie
d683c201f9 tests for GSettings action binding
https://bugzilla.gnome.org/show_bug.cgi?id=668279
2012-01-19 10:50:29 -05:00
Simon McVittie
fa4792c35e various tests: do not provoke SIGTRAP with -m no-undefined
Some of the GLib tests deliberately provoke warnings (or even fatal
errors) in a forked child. Normally, this is fine, but under valgrind
it's somewhat undesirable. We do want to follow fork(), so we can check
for leaks in child processes that exit gracefully; but we don't want to
be told about "leaks" in processes that are crashing, because there'd
be no point in cleaning those up anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=666116
2011-12-27 17:51:09 -05:00
Matthias Clasen
97cf2d78c5 settings-source test: Check returned error as well 2011-11-17 14:03:39 +00:00
Jasper St. Pierre
6339b5fe2d schema source: avoid introspection confusion
Any method that has its prefix'd argument as its first parameter will be
interpreted by introspection as a method. We don't want this, so we need
to swap the first two parameters.
2011-11-17 14:03:39 +00:00
Ryan Lortie
148f731748 Add test case and fix some bugs
Add the first test case for the schema source functionality and fix a
couple of bugs that got uncovered by that.
2011-11-17 14:03:39 +00:00
Ryan Lortie
38e8ecd62a more 'static' adding in testcases
No dead code found this time...
2011-10-16 21:41:15 -04:00
Ryan Lortie
3106391694 Revert "GSettings: don't abort on missing schemas"
This reverts commit c841c2ce3f.

This approach has been an unmitigated disaster.  We're getting all sorts
of crashes due to functions that are returning NULL because they can't
find the schema for the default value.  The people who get these crashes
are then confused about the root cause of the problem and waste a lot of
time trying to figure it out.

Until we find a better solution, we should go back to what we had
before.

https://bugzilla.gnome.org/show_bug.cgi?id=655366
2011-10-03 10:19:38 -04:00
Colin Walters
f42fe6cdc0 gvalue: Add explicitly signed g_value_get_schar() and g_value_set_schar()
The documentation for G_TYPE_CHAR says:

"The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed
 integer."

However the return value for g_value_get_char() was just "char" which
in C has an unspecified signedness; on e.g. x86 it's signed (which
matches the GType), but on e.g. PowerPC or ARM, it's not.

We can't break the old API, so we need to suck it up and add new API.
Port most internal users, but keep some tests of the old API too.

https://bugzilla.gnome.org/show_bug.cgi?id=659870
2011-09-22 20:05:38 -04:00
Ryan Lortie
c841c2ce3f GSettings: don't abort on missing schemas
Give a g_critical instead.
2011-07-20 14:06:36 +02:00
Tim-Philipp Müller
7654a848e2 tests: fix glib_translations_work()
If setlocale() to our test locale fails, translations
won't work either.

https://bugzilla.gnome.org/show_bug.cgi?id=654017
2011-07-11 00:08:14 -04:00
Matthias Clasen
309f5f978b Improve test coverage
Various test additions, mainly in GObject
2011-02-13 23:49:19 -05:00
Dan Winship
791d91a957 fix make check 2010-11-07 12:56:08 -05:00
Ryan Lortie
3c5b50c424 GSettings test: fix error match strings
The name of the internal function that appears in an assertion message
has changed.  Update the tests.
2010-10-04 21:07:50 -04:00
Ryan Lortie
d6d76783ae Bug 631263 - GSettings needs range/choice APIs
Add g_settings_get_range() to describe the possible values that may be
provided to g_settings_set_value() without causing an error.

Add a test case.
2010-10-04 02:58:46 -04:00
Ryan Lortie
90822327ac GSettings test: fix unsafe GObject properties use
The test case was passing a guint16 to g_object_get() for a guint
property.  That's invalid on all systems, although it works (more or
less) on little endian ones.  On big endian it's a total no-go.
2010-10-03 22:55:53 -04:00
Ryan Lortie
d2c0699440 Clean up g_settings_list_schemas()
In its previous form, g_settings_list_schemas() was not useful as a tool
to prevent aborts due to using g_settings_new() with an invalid schema
name.  This is because g_settings_list_scheams() also listed relocatable
schemas, and calling g_settings_new() for those would abort just the
same as if you called it for a non-existent schema.

Modify g_settings_list_schemas() so that it only returns schemas for
which it is safe to call g_settings_new().  Add another call for sake of
completeness: g_settings_list_relocatable_schemas().
2010-10-02 22:42:02 -04:00
Ryan Lortie
77e3badcf3 split GSettings.list_items => list_{children,keys}
This is an incompatible public API/ABI change.
2010-09-09 16:42:55 -04:00
Christian Persch
6320b04fe9 Plug a mem leak in gsettings test
==2530== 13 bytes in 1 blocks are definitely lost in loss record 373 of 681
==2530==    at 0x4005BDC: malloc (vg_replace_malloc.c:195)
==2530==    by 0x4057094: g_malloc (gmem.c:134)
==2530==    by 0x40573DB: g_malloc_n (gmem.c:281)
==2530==    by 0x40717FC: g_strdup (gstrfuncs.c:101)
==2530==    by 0x4147F56: value_lcopy_string (gvaluetypes.c:313)
==2530==    by 0x4123F0B: g_object_get_valist (gobject.c:1643)
==2530==    by 0x41240FF: g_object_get (gobject.c:1731)
==2530==    by 0x804A4BA: test_basic (gsettings.c:28)

Bug #628331.
2010-09-03 15:29:51 -04:00
Ryan Lortie
ca3b7b75bf GSettings: add G_SETTINGS_BIND_INVERT_BOOLEAN flag
When binding a boolean setting to a boolean property, invert the values.
This avoids the requirement for writing a pair of mapping functions for
this extremely common case.

Add a test.

https://bugzilla.gnome.org/show_bug.cgi?id=625833
2010-08-03 02:09:10 -04:00
Matthias Clasen
b77a19f238 Test g_settings_list_schemas 2010-07-30 19:51:19 -04:00
Ryan Lortie
d5bd531d96 Cleanup the GSettingsBackend API
This is a substantial ABI break.  Rebuild dconf.
2010-07-22 18:39:50 -04:00
Ryan Lortie
dc7348b305 Fix very small leak in the GSettings test 2010-07-22 11:49:30 -04:00
Ryan Lortie
23a904fc15 Bug 624991 - GSettings mapping for G_TYPE_STRV
Added default mapping for G_TYPE_STRV based on a patch from Garrett
Regier.

Add a test case.
2010-07-22 11:34:57 -04:00
Matthias Clasen
5adf506d5b Use proper variables
And also make sure we don't read garbage.
2010-07-08 11:33:21 -04:00
Ryan Lortie
d9e90c3894 GVariant: improve bytestring support
- add G_VARIANT_TYPE_BYTESTRING, _BYTESTRING_ARRAY, _STRING_ARRAY

 - remove g_variant_{new,get}_byte_array functions

 - add g_variant_{new,get,dup}_bytestring{,_array} functions

 - remove undocumented support for deserialising arrays of objectpaths
   or signature strngs using g_variant_get_strv()

 - add and document new format strings '^ay', '^&ay', '^aay' and '^a&ay'

 - update GApplication to use the new API

 - update GSettings binding code to use the new API

 - add tests
2010-07-07 16:25:48 -04:00
Matthias Clasen
20dca5935c Add several more settings tests 2010-07-05 23:13:17 -04:00
Matthias Clasen
81a0a26813 Test enum mapping 2010-07-05 23:13:17 -04:00
Matthias Clasen
dea042b855 Misc test additions 2010-07-05 03:09:36 -04:00
Ryan Lortie
5383c7110f Bug 622124 - implement flags for GSettings
Add a <flags> tag to the schema file format and a flags='' attribute to
go along with.  Add some extra test cases for those.

Add new g_settings_{get,set}_flags() calls and support binding to
GParamSpecFlags properties.  Add test cases.
2010-07-01 19:06:02 -04:00
Ryan Lortie
65fc931fb9 Rework the GSettings keyfile backend 2010-06-24 01:39:12 -04:00
Ryan Lortie
519edcc2b3 fix leaks in the GSettings test case 2010-06-24 00:39:38 -04:00
Ryan Lortie
6c3ae976e6 Bug 621266 - GSettings "context" clarification
Remove the concept of "context" in favour of dealing with
GSettingsBackend directly.
2010-06-17 14:05:40 -04:00
Ryan Lortie
d352ec2bf3 GSettings-related distcheck fixups 2010-06-17 10:50:47 -04:00
Ryan Lortie
597290d5c8 GSettings: major refactor. Add enums, range. 2010-06-16 18:17:53 -04:00
Ryan Lortie
ceee4c21a3 GSettings test case fixes
- call g_settings_sync()
 - fix bug #618715 by not forking if a backend is specified via
   environment variable
2010-06-10 22:35:31 -04:00
Matthias Clasen
486c46b945 Include the right header 2010-06-07 06:24:28 -04:00
Ryan Lortie
e1fb92551f check for working gettext() before running tests 2010-05-14 01:01:40 +02:00
Matthias Clasen
daa405c191 Rename in more places 2010-04-23 20:05:27 -04:00
Matthias Clasen
78ed401a51 Add a test for g_settings_get_child 2010-04-21 21:03:53 -04:00
Matthias Clasen
585a37f374 Handle NULL string properties in bindings
Admittely, we just handle them by failing the conversion...
2010-04-21 14:49:05 -04:00
Matthias Clasen
8a988e8e88 Test binding non-readable/writable properties 2010-04-21 12:31:10 -04:00
Christian Persch
9488d18a87 Fix gsettings mapping for uint64
Bug #616295.
2010-04-20 19:40:26 -04:00
Matthias Clasen
cd9b8b563f 2.25.0 2010-04-19 17:30:42 -04:00
Matthias Clasen
a072c1fc29 Fix up some typos in the new tests 2010-04-19 10:34:22 -04:00
Christian Persch
230038f684 Add testcase for g_settings_bind with [u]int64 properties
And use different values for the doubles test.

All of these fail currently since g_settings_bind default mapping
truncate to glong (eek!).

Bug #616119
2010-04-19 10:00:03 -04:00
Matthias Clasen
69bd033e11 Call setlocale initially
That seems to be required to make bindtextdomain work in the
l10n tests. See bug 616152.
2010-04-19 09:31:31 -04:00
Tor Lillqvist
4523b2b9cd Bypass l10n tests for now on Windows 2010-04-19 16:14:45 +03:00
Matthias Clasen
187883dc58 add a keyfile test 2010-04-17 21:20:33 -04:00
Matthias Clasen
137cee425f Correct the sense of an assertion 2010-04-17 16:48:10 -04:00