[gjs/locale-agnostic-camel-properties: 2/5] testGObjectClass: Ensure that camel-case properties are valid in all locales




commit 45f7fea17f2d19c4300449faae06829f07a04844
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Apr 28 20:03:54 2022 +0200

    testGObjectClass: Ensure that camel-case properties are valid in all locales

 installed-tests/js/testGObjectClass.js | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
---
diff --git a/installed-tests/js/testGObjectClass.js b/installed-tests/js/testGObjectClass.js
index 394ae3a25..a10ac7aab 100644
--- a/installed-tests/js/testGObjectClass.js
+++ b/installed-tests/js/testGObjectClass.js
@@ -1183,6 +1183,11 @@ describe('Auto accessor generation', function () {
                 'Construct-only property with a setter method',
                 GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
                 0, 100, 80),
+            'construct-only-was-invalid-in-turkish': GObject.ParamSpec.int(
+                'construct-only-was-invalid-in-turkish', 'Camel name in Turkish',
+                'Camel-cased property that was wrongly transformed in Turkish',
+                GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
+                0, 100, 55),
             'snake-name': GObject.ParamSpec.int('snake-name', 'Snake name',
                 'Snake-cased property', GObject.ParamFlags.READWRITE, 0, 100, 36),
             'camel-name': GObject.ParamSpec.int('camel-name', 'Camel name',
@@ -1302,6 +1307,21 @@ describe('Auto accessor generation', function () {
         expect(a._constructOnlySetterCalled).toEqual(1);
     });
 
+    it('set properties at construct time with locale', function () {
+        const {gettext: Gettext} = imports;
+        const prevLocale = Gettext.setlocale(Gettext.LocaleCategory.ALL, null);
+
+        Gettext.setlocale(Gettext.LocaleCategory.ALL, 'tr_TR');
+        a = new AutoAccessors({
+            'construct-only-was-invalid-in-turkish': 35,
+        });
+        Gettext.setlocale(Gettext.LocaleCategory.ALL, prevLocale);
+
+        expect(a.constructOnlyWasInvalidInTurkish).toEqual(35);
+        expect(a.construct_only_was_invalid_in_turkish).toEqual(35);
+        expect(a['construct-only-was-invalid-in-turkish']).toEqual(35);
+    });
+
     it('notify when the property changes', function () {
         const notify = jasmine.createSpy('notify');
         a.connect('notify::simple', notify);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]