Ejemplo n.º 1
0
  /**
   * 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());
  }
Ejemplo n.º 2
0
 /** @see junit.framework.TestCase#tearDown() */
 @Override
 protected void tearDown() throws Exception {
   lnf.setTheme(null);
   lnf.uninitialize();
   lnf = null;
   super.tearDown();
 }
Ejemplo n.º 3
0
  /** 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));
  }
Ejemplo n.º 4
0
  /**
   * 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());
  }
Ejemplo n.º 5
0
  /**
   * 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);
  }
Ejemplo n.º 6
0
  /**
   * 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);
  }
Ejemplo n.º 7
0
  /** 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);
  }
Ejemplo n.º 8
0
 /**
  * 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);
 }