[gjs/gnome-3-36] testGIMarshalling: Don't try to override methods we may not have



commit ba07ca306f56f61c32f42320fefe1b15adf634df
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Mar 17 00:16:50 2020 +0100

    testGIMarshalling: Don't try to override methods we may not have
    
    Since we don't hard-depend on a gobject-introspection version that
    includes inout tests, just include the vfuncs in case we have them.
    
    This commit can be reverted once GNOME/gobject-introspection!201 is
    merged and we depend on a version containing such commit.

 installed-tests/js/testGIMarshalling.js | 54 ++++++++++++++++++++-------------
 1 file changed, 33 insertions(+), 21 deletions(-)
---
diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js
index 0938b380..87643bac 100644
--- a/installed-tests/js/testGIMarshalling.js
+++ b/installed-tests/js/testGIMarshalling.js
@@ -1079,7 +1079,7 @@ describe('GObject', function () {
     });
 });
 
-const VFuncTester = GObject.registerClass(class VFuncTester extends GIMarshallingTests.Object {
+let VFuncTester = GObject.registerClass(class VFuncTester extends GIMarshallingTests.Object {
     vfunc_vfunc_return_value_only() {
         return 42;
     }
@@ -1100,22 +1100,6 @@ const VFuncTester = GObject.registerClass(class VFuncTester extends GIMarshallin
         return [48, 49, 50];
     }
 
-    vfunc_vfunc_one_inout_parameter(input) {
-        return input * 5;
-    }
-
-    vfunc_vfunc_multiple_inout_parameters(inputA, inputB) {
-        return [inputA * 5, inputB * -1];
-    }
-
-    vfunc_vfunc_return_value_and_one_inout_parameter(input) {
-        return [49, input * 5];
-    }
-
-    vfunc_vfunc_return_value_and_multiple_inout_parameters(inputA, inputB) {
-        return [49, inputA * 5, inputB * -1];
-    }
-
     vfunc_vfunc_array_out_parameter() {
         return [50, 51];
     }
@@ -1180,6 +1164,26 @@ const VFuncTester = GObject.registerClass(class VFuncTester extends GIMarshallin
     }
 });
 
+try {
+    VFuncTester = GObject.registerClass(class VFuncTesterInOut extends VFuncTester {
+        vfunc_vfunc_one_inout_parameter(input) {
+            return input * 5;
+        }
+
+        vfunc_vfunc_multiple_inout_parameters(inputA, inputB) {
+            return [inputA * 5, inputB * -1];
+        }
+
+        vfunc_vfunc_return_value_and_one_inout_parameter(input) {
+            return [49, input * 5];
+        }
+
+        vfunc_vfunc_return_value_and_multiple_inout_parameters(inputA, inputB) {
+            return [49, inputA * 5, inputB * -1];
+        }
+    });
+} catch {}
+
 describe('Virtual function', function () {
     let tester;
     beforeEach(function () {
@@ -1209,22 +1213,30 @@ describe('Virtual function', function () {
     });
 
     it('marshals one inout parameter', function () {
+        if (typeof VFuncTester.prototype.vfunc_one_inout_parameter === 'undefined')
+            pending('https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/201');
         expect(tester.vfunc_one_inout_parameter(10)).toEqual(50);
-    }).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/201');
+    });
 
     it('marshals multiple inout parameters', function () {
+        if (typeof VFuncTester.prototype.vfunc_multiple_inout_parameters === 'undefined')
+            pending('https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/201');
         expect(tester.vfunc_multiple_inout_parameters(10, 5)).toEqual([50, -5]);
-    }).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/201');
+    });
 
     it('marshals a return value and one inout parameter', function () {
+        if (typeof VFuncTester.prototype.vfunc_return_value_and_one_inout_parameter === 'undefined')
+            pending('https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/201');
         expect(tester.vfunc_return_value_and_one_inout_parameter(10))
             .toEqual([49, 50]);
-    }).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/201');
+    });
 
     it('marshals a return value and multiple inout parameters', function () {
+        if (typeof VFuncTester.prototype.vfunc_return_value_and_multiple_inout_parameters === 'undefined')
+            pending('https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/201');
         expect(tester.vfunc_return_value_and_multiple_inout_parameters(10, -51))
             .toEqual([49, 50, 51]);
-    }).pend('https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/201');
+    });
 
     it('marshals an array out parameter', function () {
         expect(tester.vfunc_array_out_parameter()).toEqual([50, 51]);


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