After learning that just using this mouse was not the greatest way of
figuring out whether or not the iconv helpers worked, I decided to
write a few simple tests to ensure silly things like this don't happen
again.
Changes since v1:
- fix indentation
- Fix year in copyright on test-iconv-helper.c
- Use an encoding that's definitely invalid for the
iconv_invalid_encoding test
- Add tests for a bunch of bad utf16le strings
- Add tests for converting emojis to/from utf16le. Just so we have some
actually multibyte characters in here.
Let the caller check that what they're passing in is correct, we don't have to
respond with sensible error codes here.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We do not have any driver using it, and we are not sure this will even
be required. Before releasing a version with this, remove it. We
can always re-add this later if the need appears.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
We were limited to MAX_RESOLUTIONS (10). Also, this allows to know
during ratbag_device_init_profiles() if the device supports
switchable resolutions.
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
There's no good reason to return the object from the unref() call other than
for testing purposes, and we can work around this by using valgrind instead.
The API is a lot more consistent when we always return NULL.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Nothing special about 1000, 256 checks the 2-byte boundary and beyond that
we're just testing whether the computer can count. Let's assume it can.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
And change some to drop all parent refs before we even test the struct we want
to test. This way we're more likely to blow up during the test too.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The current code has the profile ref the device, but the device has no back-ref to
the profile. The following code will free the profile from underneath the
client, despite the caller still having a valid ref:
p = ratbag_device_get_profile_by_index(device, 0);
ratbag_profile_ref(p);
ratbag_device_unref(device);
Fix this by not using refs internally. After probe, the device is static
anyway, so the various refs internally aren't needed. Instead, we also ref/unref
the parent struct whenever we ref/unref a struct. Thus, whenevever the device
refcount reaches zero, we know the caller has no ref active.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Two components are added here: a test driver that takes a struct
ratbag_test_device and sets that device up as a ratbag device.
That device is returned to the tests and then checked for sanity.
The ratbag_device_new_test_device() requires the environment variable
RATBAG_TEST set, otherwise we abort. It's also 'hidden' in a separate source
file, so it won't show up in doxygen. And if the test are disabled, this
function does nothing and the test driver never gets registered.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Naming scheme is now:
* ratbag - the context
* ratbag_device - the device
* ratbag_profile
* ratbag_button
...
Only leftovers of "libratbag" are the header file name, #defines that are
exported through that header file and anything that has to do with the actual
library iself (e.g. the symbol export file).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>