/** * Test of the method <code>getTheme()</code>. * * @throws Exception handled by JUnit */ public void testGetTheme() throws Exception { assertEquals(RienaDefaultTheme.class, lnf.getTheme().getClass()); lnf.setTheme(new DummyTheme()); assertEquals(DummyTheme.class, lnf.getTheme().getClass()); }
/** @see junit.framework.TestCase#tearDown() */ @Override protected void tearDown() throws Exception { lnf.setTheme(null); lnf.uninitialize(); lnf = null; super.tearDown(); }
/** Tests the <i>private</i> method {@code readSystemProperties()}. */ public void testReadSystemProperties() { lnf.setTheme(new DummyTheme()); lnf.initialize(); assertEquals(INTEGER_VALUE, lnf.getIntegerSetting(INTEGER_KEY)); System.setProperty("riena.lnf.setting." + INTEGER_KEY, "4711"); ReflectionUtils.invokeHidden(lnf, "readSystemProperties"); assertEquals(Integer.valueOf(4711), lnf.getIntegerSetting(INTEGER_KEY)); }
/** * Test of the method {@code getIntegerSetting(String, Integer)}. * * @throws Exception handled by JUnit */ public void testGetIntegerSetting() throws Exception { Integer value = lnf.getIntegerSetting(INTEGER_KEY, 300); assertEquals(300, value.intValue()); lnf.setTheme(new DummyTheme()); lnf.initialize(); value = lnf.getIntegerSetting(INTEGER_KEY, 300); assertEquals(INTEGER_VALUE.intValue(), value.intValue()); }
/** * Test of the method {@code getBooleanSetting(String, boolean)}. * * @throws Exception handled by JUnit */ public void testGetBooleanSetting() throws Exception { boolean value = lnf.getBooleanSetting(BOOLEAN_KEY, true); assertTrue(value); value = lnf.getBooleanSetting(BOOLEAN_KEY, false); assertFalse(value); lnf.setTheme(new DummyTheme()); lnf.initialize(); value = lnf.getBooleanSetting(BOOLEAN_KEY, false); assertEquals(BOOLEAN_VALUE, value); }
/** * Test of the method <code>setTheme()</code>. * * @throws Exception handled by JUnit */ public void testSetTheme() throws Exception { final Color color1 = lnf.getColor(LnfKeyConstants.EMBEDDED_TITLEBAR_ACTIVE_FOREGROUND); assertNotNull(color1); lnf.setTheme(new DummyTheme()); lnf.initialize(); assertFalse(color1.isDisposed()); final Color color2 = lnf.getColor(LnfKeyConstants.EMBEDDED_TITLEBAR_ACTIVE_FOREGROUND); assertNull(color2); }
/** Tests the method {@code getMarkerSupport}. */ public void testGetMarkerSupport() { lnf.update( new ILnfMarkerSupportExtension[] { new ILnfMarkerSupportExtension() { public String getId() { return "defaultMarkerSupport"; } public AbstractMarkerSupport createMarkerSupport() { return new MarkerSupport(); } }, new ILnfMarkerSupportExtension() { public String getId() { return "borderMarkerSupport"; } public AbstractMarkerSupport createMarkerSupport() { return new BorderMarkerSupport(); } } }); AbstractMarkerSupport markerSupport = lnf.getMarkerSupport(null); assertNotNull(markerSupport); assertTrue(markerSupport.getClass() == BorderMarkerSupport.class); lnf.setTheme(new DummyTheme()); lnf.initialize(); markerSupport = lnf.getMarkerSupport(null); assertNull(markerSupport); lnf.setTheme(new DummyTheme2()); lnf.initialize(); markerSupport = lnf.getMarkerSupport(null); assertNotNull(markerSupport); assertTrue(markerSupport.getClass() == BorderMarkerSupport.class); }
/** * Create a look and feel with the given theme. * * @param theme the theme this look and feel will use */ public RienaDefaultLnf(final ILnfTheme theme) { setTheme(theme); }