This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch GROOVY_5_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_5_0_X by this push:
     new 86477dcef0 GROOVY-11876: add test case
86477dcef0 is described below

commit 86477dcef0498289059ed38973974fd10cc482a3
Author: Eric Milles <[email protected]>
AuthorDate: Sat Mar 21 09:55:28 2026 -0500

    GROOVY-11876: add test case
---
 .../groovy/groovy/swing/SwingBuilderTest.groovy    |  2 +-
 .../groovy/swing/beans/BindableSwingTest.groovy    | 66 +++++++++++++++++-----
 .../groovy/swing/beans/VetoableSwingTest.groovy    | 34 ++++++-----
 3 files changed, 74 insertions(+), 28 deletions(-)

diff --git 
a/subprojects/groovy-swing/src/test/groovy/groovy/swing/SwingBuilderTest.groovy 
b/subprojects/groovy-swing/src/test/groovy/groovy/swing/SwingBuilderTest.groovy
index 3a7e7aca14..7fcfee99fe 100644
--- 
a/subprojects/groovy-swing/src/test/groovy/groovy/swing/SwingBuilderTest.groovy
+++ 
b/subprojects/groovy-swing/src/test/groovy/groovy/swing/SwingBuilderTest.groovy
@@ -1428,7 +1428,7 @@ class SwingBuilderTest extends GroovySwingTestCase {
                 swing.lookAndFeel('metal', boldFonts: true) { laf ->
                     assert laf instanceof MetalLookAndFeel
                 }
-                swing.lookAndFeel(lookAndFeel: 'metal', boldFonts: true) { laf 
->
+                swing.lookAndFeel(null, lookAndFeel: 'metal', boldFonts: true) 
{ laf ->
                     assert laf instanceof MetalLookAndFeel
                 }
                 swing.lookAndFeel() { laf ->
diff --git 
a/subprojects/groovy-swing/src/test/groovy/groovy/swing/beans/BindableSwingTest.groovy
 
b/subprojects/groovy-swing/src/test/groovy/groovy/swing/beans/BindableSwingTest.groovy
index 202da85494..dbe8579107 100644
--- 
a/subprojects/groovy-swing/src/test/groovy/groovy/swing/beans/BindableSwingTest.groovy
+++ 
b/subprojects/groovy-swing/src/test/groovy/groovy/swing/beans/BindableSwingTest.groovy
@@ -18,28 +18,68 @@
  */
 package groovy.swing.beans
 
-import org.junit.Test
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.Test
 
-import static groovy.swing.GroovySwingTestCase.testInEDT
+import static groovy.test.GroovyAssert.assertScript
+import static groovy.util.HeadlessTestSupport.isHeadless
+import static org.junit.jupiter.api.Assumptions.assumeFalse
 
 final class BindableSwingTest {
 
+    @BeforeEach
+    void setUp() {
+        assumeFalse(isHeadless())
+    }
+
     // GROOVY-8339, GROOVY-10070
     @Test
     void testExtendsComponent() {
-        testInEDT {
-            new GroovyShell().evaluate '''
-                class BindableTestBean extends javax.swing.JPanel {
-                    @groovy.beans.Bindable String testValue
+        assertScript '''
+            class BindableTestBean extends javax.swing.JPanel {
+                @groovy.beans.Bindable String testValue
+            }
+
+            changed = false
+
+            def bean = new BindableTestBean(testValue: 'foo')
+            bean.propertyChange = {changed = true}
+            bean.testValue = 'bar'
+            assert changed
+        '''
+    }
+
+    // GROOVY-11876
+    @Test
+    void testBindableProperties() {
+        assertScript '''
+            import groovy.beans.Bindable
+            import groovy.swing.SwingBuilder
+
+            class Main {
+                @Bindable
+                static class Bean {
+                    String foo = 'bar'
                 }
 
-                changed = false
+                static def  bean1 = new Bean()
+                static Bean bean2 = new Bean()
+
+                static main(args) {
+                    new SwingBuilder().edt {
+                        def label1 = label(text: bind { bean1.foo })
+                        def label2 = label(text: bind { bean2.foo })
 
-                def bean = new BindableTestBean(testValue: 'foo')
-                bean.propertyChange = {changed = true}
-                bean.testValue = 'bar'
-                assert changed
-            '''
-        }
+                        assert label1.text == 'bar'
+                        bean1.foo = 'baz'
+                        assert label1.text == 'baz'
+
+                        assert label2.text == 'bar'
+                        bean2.foo = 'baz'
+                        assert label2.text == 'baz'
+                    }
+                }
+            }
+        '''
     }
 }
diff --git 
a/subprojects/groovy-swing/src/test/groovy/groovy/swing/beans/VetoableSwingTest.groovy
 
b/subprojects/groovy-swing/src/test/groovy/groovy/swing/beans/VetoableSwingTest.groovy
index d12c82311b..0e57201b8a 100644
--- 
a/subprojects/groovy-swing/src/test/groovy/groovy/swing/beans/VetoableSwingTest.groovy
+++ 
b/subprojects/groovy-swing/src/test/groovy/groovy/swing/beans/VetoableSwingTest.groovy
@@ -18,28 +18,34 @@
  */
 package groovy.swing.beans
 
-import org.junit.Test
+import org.junit.jupiter.api.BeforeEach
+import org.junit.jupiter.api.Test
 
-import static groovy.swing.GroovySwingTestCase.testInEDT
+import static groovy.test.GroovyAssert.assertScript
+import static groovy.util.HeadlessTestSupport.isHeadless
+import static org.junit.jupiter.api.Assumptions.assumeFalse
 
 final class VetoableSwingTest {
 
+    @BeforeEach
+    void setUp() {
+        assumeFalse(isHeadless())
+    }
+
     // GROOVY-8339, GROOVY-10070
     @Test
     void testExtendsComponent() {
-        testInEDT {
-            new GroovyShell().evaluate '''
-                class VetoableTestBean extends javax.swing.JPanel {
-                    @groovy.beans.Vetoable String testValue
-                }
+        assertScript '''
+            class VetoableTestBean extends javax.swing.JPanel {
+                @groovy.beans.Vetoable String testValue
+            }
 
-                changed = false
+            changed = false
 
-                def bean = new VetoableTestBean(testValue: 'foo')
-                bean.vetoableChange = {changed = true}
-                bean.testValue = 'bar'
-                assert changed
-            '''
-        }
+            def bean = new VetoableTestBean(testValue: 'foo')
+            bean.vetoableChange = {changed = true}
+            bean.testValue = 'bar'
+            assert changed
+        '''
     }
 }

Reply via email to