[gjs: 1/2] tests: Move Cairo-based GIMarshallingTests test to testCairo



commit 42fb9b4ab758333b822796612df1a67c9c6654e1
Author: Philip Chimento <philip chimento gmail com>
Date:   Fri Aug 16 19:35:07 2019 -0700

    tests: Move Cairo-based GIMarshallingTests test to testCairo
    
    This test needs to be enabled only if the cairo tests are enabled.

 installed-tests/js/testCairo.js         | 11 ++++++++---
 installed-tests/js/testGIMarshalling.js | 19 +++----------------
 2 files changed, 11 insertions(+), 19 deletions(-)
---
diff --git a/installed-tests/js/testCairo.js b/installed-tests/js/testCairo.js
index 8c10766d..f3d6fd41 100644
--- a/installed-tests/js/testCairo.js
+++ b/installed-tests/js/testCairo.js
@@ -2,9 +2,7 @@ imports.gi.versions.Gdk = '3.0';
 imports.gi.versions.Gtk = '3.0';
 
 const Cairo = imports.cairo;
-const Gdk = imports.gi.Gdk;
-const Gtk = imports.gi.Gtk;
-const Regress = imports.gi.Regress;
+const {Gdk, GIMarshallingTests, Gtk, Regress} = imports.gi;
 
 function _ts(obj) {
     return obj.toString().slice(8, -1);
@@ -266,6 +264,13 @@ describe('Cairo', function () {
             o.emit_sig_with_foreign_struct();
             expect(foreignSpy).toHaveBeenCalledWith(o, cr);
         });
+
+        it('can have its type inferred as a foreign struct', function () {
+            expect(() => GIMarshallingTests.gvalue_in_with_type(cr, Cairo.Context))
+                .not.toThrow();
+            expect(() => GIMarshallingTests.gvalue_in_with_type(surface, Cairo.Surface))
+                .not.toThrow();
+        });
     });
 });
 
diff --git a/installed-tests/js/testGIMarshalling.js b/installed-tests/js/testGIMarshalling.js
index dd072beb..a10d8fda 100644
--- a/installed-tests/js/testGIMarshalling.js
+++ b/installed-tests/js/testGIMarshalling.js
@@ -836,22 +836,9 @@ describe('GValue', function () {
             .not.toThrow();
     });
 
-    it('can have its type inferred as a foreign struct', function () {
-        let Cairo;
-        try {
-            Cairo = imports.cairo;
-        } catch (e) {
-            pending('Compiled without Cairo support');
-            return;
-        }
-
-        let surface = new Cairo.ImageSurface(Cairo.Format.ARGB32, 2, 2);
-        let cr = new Cairo.Context(surface);
-        expect(() => GIMarshallingTests.gvalue_in_with_type(cr, Cairo.Context))
-            .not.toThrow();
-        expect(() => GIMarshallingTests.gvalue_in_with_type(surface, Cairo.Surface))
-            .not.toThrow();
-    });
+    // See testCairo.js for a test of GIMarshallingTests.gvalue_in_with_type()
+    // on Cairo foreign structs, since it will be skipped if compiling without
+    // Cairo support.
 });
 
 describe('Callback', function () {


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