예제 #1
0
  /** Test method for {@link org.jajuk.util.filters.AudioFilter#accept(java.io.File)}. */
  public void testAcceptFile() {
    StartupCollectionService.registerTypes();

    // normal files
    assertFalse(AudioFilter.getInstance().accept(new File("test.tst")));
    assertTrue(AudioFilter.getInstance().accept(new File("test.mp3")));
    assertTrue(AudioFilter.getInstance().accept(new File("test.ogg")));
    assertTrue(AudioFilter.getInstance().accept(new File("test.MP3"))); // files
    // copied
    // from
    // windows
    // to
    // linux
    // might
    // be
    // uppercase
    assertTrue(AudioFilter.getInstance().accept(new File("test.OGG")));
    assertTrue(AudioFilter.getInstance().accept(new File("test.mP3"))); // manually
    // entered
    // filenames
    // might
    // be
    // lowercase/uppercase
    // mixed
    assertTrue(AudioFilter.getInstance().accept(new File("test.ogG")));

    // directories, depends on the setting
    AudioFilter.getInstance().setAcceptDirectories(false);
    assertFalse(AudioFilter.getInstance().accept(new File(System.getProperty("java.io.tmpdir"))));
    AudioFilter.getInstance().setAcceptDirectories(true);
    assertTrue(AudioFilter.getInstance().accept(new File(System.getProperty("java.io.tmpdir"))));
  }
예제 #2
0
  /** Test method for {@link org.jajuk.util.filters.AudioFilter#getDescription()} . */
  public void testGetDescription() {
    StartupCollectionService.registerTypes();

    assertTrue(
        AudioFilter.getInstance().getDescription(),
        StringUtils.containsIgnoreCase(AudioFilter.getInstance().getDescription(), "mp3"));
    assertTrue(
        AudioFilter.getInstance().getDescription(),
        StringUtils.containsIgnoreCase(AudioFilter.getInstance().getDescription(), "ogg"));

    // try removing all types
    TypeManager.getInstance().clear();
    assertEquals("", AudioFilter.getInstance().getDescription());
  }
예제 #3
0
 /**
  * Test method for {@link org.jajuk.base.TypeManager#getAllMusicTypes()}.
  *
  * @throws Exception the exception
  */
 public void testGetAllMusicTypes() throws Exception {
   // we need the ItemManagers when using properties
   StartupCollectionService.registerItemManagers();
   // no type initially
   assertEquals(0, TypeManager.getInstance().getAllMusicTypes().size());
   // register a type
   assertNotNull(TypeManager.getInstance().registerType("testtype", "tst", null, null));
   // still no type now as it does not have "music" property set
   assertEquals(0, TypeManager.getInstance().getAllMusicTypes().size());
   // add another type with "true" for "music"
   Type type = TypeManager.getInstance().registerType("testtype2", "tst2", null, null);
   type.setProperty(Const.XML_TYPE_IS_MUSIC, true);
   // now we have one music-type
   assertEquals(1, TypeManager.getInstance().getAllMusicTypes().size());
   // add default types
   TypeManager.registerTypesNoMplayer();
   // many types now
   assertTrue(TypeManager.getInstance().getAllMusicTypes().size() > 1);
 }