From 93a10cd84db66c204324acdb8c9c4b2e25658601 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Sat, 14 Aug 2021 22:44:52 +0200 Subject: [PATCH] tests: Another test for misparsed scale in some locales Polling accelerometer drivers read the accelerometer scales using libgudev. Check that libgudev is new enough and this bug is fixed: https://gitlab.gnome.org/GNOME/libgudev/-/merge_requests/17 --- tests/integration-test | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/integration-test b/tests/integration-test index 534136d..a55f820 100755 --- a/tests/integration-test +++ b/tests/integration-test @@ -595,6 +595,36 @@ class Tests(dbusmock.DBusTestCase): self.stop_daemon() + def test_iio_scale_decimal_separator2(self): + '''scale decimal separator polling''' + accel = self.testbed.add_device('iio', 'iio-accel', None, + ['in_accel_x_raw', '0', + 'in_accel_y_raw', '-256000000', + 'in_accel_z_raw', '0', + 'in_accel_scale', '0.000001', + 'sampling_frequency', '5.2', + 'name', 'IIO Test Accelerometer'], + ['NAME', '"IIO Accelerometer"', + 'IIO_SENSOR_PROXY_TYPE', 'iio-poll-accel'] + ) + env = os.environ.copy() + env['LC_NUMERIC'] = 'fr_FR.UTF-8' + self.start_daemon(env=env) + + self.proxy.ClaimAccelerometer() + self.assertEventually(lambda: self.have_text_in_log('Accel read from IIO on')) + # If the 2nd test fails, it's likely that fr_FR.UTF-8 locale isn't supported + self.assertEqual(self.have_text_in_log('scale 1,000000,1,000000,1,000000'), False) + self.assertEqual(self.have_text_in_log('scale 0,000001,0,000001,0,000001'), True) + + self.assertEventually(lambda: self.get_dbus_property('AccelerometerOrientation') == 'normal') + + self.testbed.set_attribute(accel, 'in_accel_x_raw', '-256000000') + self.testbed.set_attribute(accel, 'in_accel_y_raw', '0') + self.assertEventually(lambda: self.get_dbus_property('AccelerometerOrientation') == 'right-up') + + self.stop_daemon() + # # Helper methods #