b10: regression?

Florian Brunner fbrunnerlist at gmx.ch
Mon Jun 4 16:40:33 PDT 2012


Hi Jonathan,

Thanks for your response.

Could you already integrate your patch? Do you have a JIRA issue for this or should I create one?

Regards,
Florian

Am Freitag 01 Juni 2012, 02:41:09 schrieb Jonathan Giles:
> Actually, controls do need to know the screen, but this is just a recent 
> change for use in embedded situations. We need to know the screen 
> resolution to determine what CSS to load (so we can load CSS more suited 
> to lower resolution monitors).
> 
> However, this email thread has popped up an issue - we're testing 
> whether we're on a QVGA screen even when isEmbedded() is false. Moving 
> the check inside the isEmbedded() if block will present getting the 
> screen measurements. I'll make this change after lunch.
> 
> diff --git 
> a/javafx-ui-controls/src/javafx/scene/control/UAStylesheetLoader.java 
> b/javafx-ui-controls/src/javafx/scene/control/UAStylesheetLoader.java
> --- a/javafx-ui-controls/src/javafx/scene/control/UAStylesheetLoader.java
> +++ b/javafx-ui-controls/src/javafx/scene/control/UAStylesheetLoader.java
> @@ -64,12 +64,13 @@
>                           if (com.sun.javafx.PlatformUtil.isEmbedded()) {
>                               url = 
> SkinBase.class.getResource("caspian/embedded.css");
>                               
> StyleManager.getInstance().addUserAgentStylesheet(url.toExternalForm());
> +
> +                            if (com.sun.javafx.Utils.isQVGAScreen()) {
> +                                url = 
> SkinBase.class.getResource("caspian/embedded-qvga.css");
> +                                
> StyleManager.getInstance().addUserAgentStylesheet(url.toExternalForm());
> +                            }
>                           }
> 
> -                        if (com.sun.javafx.Utils.isQVGAScreen()) {
> -                            url = 
> SkinBase.class.getResource("caspian/embedded-qvga.css");
> -                            
> StyleManager.getInstance().addUserAgentStylesheet(url.toExternalForm());
> -                        }
>                           stylesheetLoaded = true;
>                       return null;
>                   }
> 
> -- Jonathan
> 
> 
> On 1/06/2012 12:34 p.m., Richard Bair wrote:
> > Definitely file a bug. CheckBox should never (ever!) require the Screen to be queried, since looking up the Screens takes time and will negatively impact startup.
> >
> > Thanks
> > Richard
> >
> > On May 31, 2012, at 3:32 PM, Florian Brunner wrote:
> >
> >> Hi,
> >>
> >> On Linux (32-bit) with JavaFX 2.2 b08 I was able to instantiate a control in a unit test, e.g.
> >>
> >> import javafx.scene.control.CheckBox;
> >> import org.junit.After;
> >> import org.junit.Before;
> >> import org.junit.Test;
> >>
> >>
> >> public class MyTest {
> >>
> >>     public MyTest() {
> >>     }
> >>
> >>
> >>     @Before
> >>     public void setUp() {
> >>         CheckBox cb = new CheckBox("test");
> >>     }
> >>
> >>     @After
> >>     public void tearDown() {
> >>     }
> >>
> >>
> >>     @Test
> >>     public void someTest() {
> >>         System.out.println("someTest");
> >>     }
> >>
> >> }
> >>
> >> With b10 I'm getting an error:
> >>
> >> java.lang.ExceptionInInitializerError
> >> 	at mypackage.MyTest.setUp(MyTest.java:28)
> >> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> 	at java.lang.reflect.Method.invoke(Method.java:601)
> >> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
> >> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
> >> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
> >> 	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
> >> 	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
> >> 	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
> >> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
> >> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
> >> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
> >> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
> >> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
> >> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
> >> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
> >> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
> >> 	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
> >> 	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
> >> 	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
> >> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> 	at java.lang.reflect.Method.invoke(Method.java:601)
> >> 	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
> >> 	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
> >> 	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
> >> 	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
> >> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
> >> Caused by: java.lang.NullPointerException
> >> 	at com.sun.glass.ui.Screen.getMainScreen(Screen.java:15)
> >> 	at com.sun.javafx.tk.quantum.QuantumToolkit.getPrimaryScreen(QuantumToolkit.java:589)
> >> 	at javafx.stage.Screen.updateConfiguration(Screen.java:102)
> >> 	at javafx.stage.Screen.checkDirty(Screen.java:97)
> >> 	at javafx.stage.Screen.getPrimary(Screen.java:176)
> >> 	at com.sun.javafx.Utils.isQVGAScreen(Utils.java:813)
> >> 	at javafx.scene.control.UAStylesheetLoader$1.run(UAStylesheetLoader.java:69)
> >> 	at java.security.AccessController.doPrivileged(Native Method)
> >> 	at javafx.scene.control.UAStylesheetLoader.loadUAStylesheet(UAStylesheetLoader.java:58)
> >> 	at javafx.scene.control.UAStylesheetLoader.doLoad(UAStylesheetLoader.java:51)
> >> 	at javafx.scene.control.Control.<clinit>(Control.java:95)
> >> 	... 31 more
> >>
> >>
> >> Is this a regression or a desired behaviour? If it's a desired behaviour: Is there a way to write some simple JUnit tests for controls?
> >>
> >> Regards,
> >> Florian
> 



More information about the openjfx-dev mailing list