[gnome-shell] tests/background-size: Remove ClutterActor::paint signal handler usage



commit 012af56b373184d48e81bc7a5e4f599bd833eb7f
Author: Jonas Dreßler <verdre v0yd nl>
Date:   Fri Oct 23 22:05:13 2020 +0200

    tests/background-size: Remove ClutterActor::paint signal handler usage
    
    The background-size interactive test includes a test-case which uses the
    ClutterActor::paint signal to hijack the painting of the actor. We're
    removing that signal from Clutter, so remove that signal handler and
    paint the outer border unconditionally to mark the boundaries of the
    widget (the outer border actually never worked to force the cairo/cogl
    path). To fix the test, change it to not paint a border on the inner
    container in the useCairo=false case, which should make sure the cogl
    path gets used.
    
    Also remove the useless useCairo argument from addTestLine().
    
    https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1479

 tests/interactive/background-size.js | 43 +++++-------------------------------
 1 file changed, 5 insertions(+), 38 deletions(-)
---
diff --git a/tests/interactive/background-size.js b/tests/interactive/background-size.js
index 064bc9e868..8f8738da91 100644
--- a/tests/interactive/background-size.js
+++ b/tests/interactive/background-size.js
@@ -27,49 +27,16 @@ function test() {
     let tbox = null;
 
     function addTestCase(image, size, backgroundSize, useCairo) {
-        // Using a border in CSS forces cairo rendering.
-        // To get a border using cogl, we paint a border using
-        // paint signal hacks.
-
-        let obin = new St.Bin();
-        if (useCairo)
-            obin.style = 'border: 3px solid green;';
-        else
-            obin.connect_after('paint', (actor, paintContext) => {
-                let framebuffer = paintContext.get_framebuffer();
-                let coglContext = framebuffer.get_context();
-
-                let pipeline = new Cogl.Pipeline(coglContext);
-                pipeline.set_color4f(0, 1, 0, 1);
-
-                let alloc = actor.get_allocation_box();
-                let width = 3;
-
-                // clockwise order
-                framebuffer.draw_rectangle(pipeline,
-                                           0, 0, alloc.get_width(), width);
-                framebuffer.draw_rectangle(pipeline,
-                                           alloc.get_width() - width, width,
-                                           alloc.get_width(), alloc.get_height());
-                framebuffer.draw_rectangle(pipeline,
-                                           0,
-                                           alloc.get_height(),
-                                           alloc.get_width() - width,
-                                           alloc.get_height() - width);
-                framebuffer.draw_rectangle(pipeline,
-                                           0,
-                                           alloc.get_height() - width,
-                                           width,
-                                           width);
-            });
+        let obin = new St.Bin({ style: 'border: 3px solid green;' });
         tbox.add(obin);
 
         let [width, height] = size;
         let bin = new St.Bin({ style_class: 'background-image-' + image,
                                width: width,
                                height: height,
-                               style: 'border: 1px solid transparent;'
-                               + 'background-size: ' + backgroundSize + ';',
+                               style: `${useCairo
+                                   ? 'border: 1px solid transparent;' : ''
+                               } background-size: ${backgroundSize};`,
                                x_fill: true,
                                y_fill: true
                              });
@@ -81,7 +48,7 @@ function test() {
                                    }));
     }
 
-    function addTestLine(image, size, useCairo) {
+    function addTestLine(image, size) {
         const backgroundSizes = ["auto", "contain", "cover", "200px 200px", "100px 100px", "100px 200px"];
 
         let [width, height] = size;


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