[gjs/gnome-3-36] Fixed error in _init() that prevented GType objects from being created. Improved the regression test



commit 1304991b69a2e44f7b05e5c2078d496bc6261fb3
Author: Nina Pypchenko <22447785+nina-py users noreply github com>
Date:   Wed Oct 14 21:02:31 2020 +1100

    Fixed error in _init() that prevented GType objects from being created.
    Improved the regression test, implementing Marco T's feedback.
    
    Closes #238.

 installed-tests/js/testGObject.js | 11 +++++++++++
 modules/core/overrides/GObject.js |  2 +-
 2 files changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/installed-tests/js/testGObject.js b/installed-tests/js/testGObject.js
index 49bbba31..16666c05 100644
--- a/installed-tests/js/testGObject.js
+++ b/installed-tests/js/testGObject.js
@@ -48,3 +48,14 @@ describe('GObject overrides', function () {
         });
     });
 });
+
+describe('GObject should', function () {
+    const types = ['gpointer', 'GBoxed', 'GParam', 'GInterface', 'GObject', 'GVariant'];
+
+    types.forEach(type => {
+        it(`be able to create a GType object for ${type}`, function () {
+            const gtype = GObject.Type(type);
+            expect(gtype.name).toEqual(type);
+        });
+    });
+});
diff --git a/modules/core/overrides/GObject.js b/modules/core/overrides/GObject.js
index a5747c21..bf729b96 100644
--- a/modules/core/overrides/GObject.js
+++ b/modules/core/overrides/GObject.js
@@ -243,7 +243,7 @@ function _init() {
         let gtype = GObject.type_from_name(gtypeName);
         obj[`TYPE_${upperName}`] = gtype;
         obj[name] = function (v) {
-            return new actual(v);
+            return actual(v);
         };
         obj[name].$gtype = gtype;
     }


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