예제 #1
0
  public void testSetAndGetIsSoundNotificationTrackSkippedEnabled() {
    WAILSettings.setSoundNotificationTrackSkippedEnabled(getContext(), true);
    assertTrue(WAILSettings.isSoundNotificationTrackSkippedEnabled(getContext()));

    WAILSettings.setSoundNotificationTrackSkippedEnabled(getContext(), false);
    assertFalse(WAILSettings.isSoundNotificationTrackSkippedEnabled(getContext()));
  }
예제 #2
0
  public void testSetAndGetIsShowFeedbackRequest() {
    WAILSettings.setShowFeedbackRequest(getContext(), false);
    assertFalse(WAILSettings.isShowFeedbackRequest(getContext()));

    WAILSettings.setShowFeedbackRequest(getContext(), true);
    assertTrue(WAILSettings.isShowFeedbackRequest(getContext()));
  }
예제 #3
0
  public void testSetAndGetLastfmUserInfo() throws Exception {
    final String userInfoJSON =
        "\n"
            + "{\"user\":{\"name\":\"RJ\",\"realname\":\"Richard Jones \",\"image\":[{\"#text\":\"http:\\/\\/userserve-ak.last.fm\\/serve\\/34\\/84504153.jpg\",\"size\":\"small\"},{\"#text\":\"http:\\/\\/userserve-ak.last.fm\\/serve\\/64\\/84504153.jpg\",\"size\":\"medium\"},{\"#text\":\"http:\\/\\/userserve-ak.last.fm\\/serve\\/126\\/84504153.jpg\",\"size\":\"large\"},{\"#text\":\"http:\\/\\/userserve-ak.last.fm\\/serve\\/252\\/84504153.jpg\",\"size\":\"extralarge\"}],\"url\":\"http:\\/\\/www.last.fm\\/user\\/RJ\",\"id\":\"1000002\",\"country\":\"UK\",\"age\":\"31\",\"gender\":\"m\",\"subscriber\":\"1\",\"playcount\":\"89564\",\"playlists\":\"4\",\"bootstrap\":\"0\",\"registered\":{\"#text\":\"2002-11-20 11:50\",\"unixtime\":\"1037793040\"},\"type\":\"alumni\"}}";

    assertNull(WAILSettings.getLastfmUserInfo(getContext()));
    WAILSettings.setLastfmUserInfo(getContext(), userInfoJSON);
    assertEquals(
        LFUserResponseModel.parseFromJSON(userInfoJSON),
        WAILSettings.getLastfmUserInfo(getContext()));
  }
예제 #4
0
  public void testSetAndGetLastCapturedTrackInfo() {
    assertNull(WAILSettings.getLastCapturedTrackInfo(getContext()));
    Track track = TestTrackFactory.newTrackWithRandomData();

    WAILService.LastCapturedTrackInfo trackInfo =
        new WAILService.LastCapturedTrackInfo(track, true);

    WAILSettings.setLastCapturedTrackInfo(getContext(), trackInfo);
    WAILService.LastCapturedTrackInfo actualTrackInfo =
        WAILSettings.getLastCapturedTrackInfo(getContext());

    assertNotNull(actualTrackInfo);
    assertTrue(actualTrackInfo.isPlaying());
    assertEquals(track, actualTrackInfo.getTrack());
  }
예제 #5
0
 public void testGetLastfmApiKeyNotNull() {
   assertNotNull(WAILSettings.getLastfmApiKey());
 }
예제 #6
0
 public void testIsAuthorizedWithSessionKey() {
   WAILSettings.setLastfmSessionKey(getContext(), "asasdff");
   assertTrue(WAILSettings.isAuthorized(getContext()));
 }
예제 #7
0
 public void testGetLastfmUserNameDefault() {
   assertEquals("", WAILSettings.getLastfmUserName(getContext()));
 }
예제 #8
0
 public void testIsFirstLaunchDefault() {
   assertTrue(WAILSettings.isFirstLaunch(getContext()));
 }
예제 #9
0
 public void testSetAndGetLastfmSessionKey() {
   assertNull(WAILSettings.getLastfmSessionKey(getContext()));
   String value = "fakjasfolasddaf";
   WAILSettings.setLastfmSessionKey(getContext(), value);
   assertEquals(value, WAILSettings.getLastfmSessionKey(getContext()));
 }
예제 #10
0
 public void testSetAndGetIsStartOnBoot() {
   assertTrue(WAILSettings.isStartOnBoot(getContext()));
   WAILSettings.setStartOnBoot(getContext(), false);
   assertFalse(WAILSettings.isStartOnBoot(getContext()));
 }
예제 #11
0
 public void testSetAndGetIsEnabled() {
   assertFalse(WAILSettings.isEnabled(getContext()));
   WAILSettings.setEnabled(getContext(), true);
   assertTrue(WAILSettings.isEnabled(getContext()));
 }
예제 #12
0
 public void testSetAndGetLastfmUserInfoUpdateTimestamp() {
   final long timestamp = System.currentTimeMillis();
   WAILSettings.setLastfmUserInfoUpdateTimestamp(getContext(), timestamp);
   assertEquals(timestamp, WAILSettings.getLastfmUserInfoUpdateTimestamp(getContext()));
 }
예제 #13
0
 public void testGetLastfmUserInfoUpdateTimestampDefault() {
   assertEquals(-1, WAILSettings.getLastfmUserInfoUpdateTimestamp(getContext()));
 }
예제 #14
0
 public void testGetLastfmUserInfoDefault() {
   assertNull(WAILSettings.getLastfmUserInfo(getContext()));
 }
예제 #15
0
 public void testGetLastCapturedTrackInfoDefault() {
   assertNull(WAILSettings.getLastCapturedTrackInfo(getContext()));
 }
예제 #16
0
 public void testSetAndGetIsFirstLaunch() {
   assertTrue(WAILSettings.isFirstLaunch(getContext()));
   WAILSettings.setIsFirstLaunch(getContext(), false);
   assertFalse(WAILSettings.isFirstLaunch(getContext()));
 }
예제 #17
0
 public void testGetLastfmSecret() {
   assertNotNull(WAILSettings.getLastfmSecret());
 }
예제 #18
0
 public void testIsAuthorizedDefault() {
   assertFalse(WAILSettings.isAuthorized(getContext()));
 }
예제 #19
0
 public void testIsEnabledDefault() {
   assertFalse(WAILSettings.isEnabled(getContext()));
 }
예제 #20
0
 public void testIsSoundNotificationTrackSkippedEnabledDefault() {
   assertFalse(WAILSettings.isSoundNotificationTrackSkippedEnabled(getContext()));
 }
예제 #21
0
 public void testIsStartOnBootDefault() {
   assertTrue(WAILSettings.isStartOnBoot(getContext()));
 }
예제 #22
0
 public void testGetMinTrackDurationInSecondsDefault() {
   assertEquals(
       WAILSettings.DEFAULT_MIN_TRACK_DURATION_IN_SECONDS,
       WAILSettings.getMinTrackDurationInSeconds(getContext()));
 }
예제 #23
0
 public void testGetLastfmSessionKeyDefault() {
   assertNull(WAILSettings.getLastfmSessionKey(getContext()));
 }
예제 #24
0
 public void testGetTotalHandledTracksCountDefault() {
   assertEquals(0, WAILSettings.getTotalHandledTracksCount(getContext()));
 }
예제 #25
0
 public void testGetMinTrackDurationInPercentsDefault() {
   assertEquals(
       WAILSettings.DEFAULT_MIN_TRACK_DURATION_IN_PERCENT,
       WAILSettings.getMinTrackDurationInPercents(getContext()));
 }
예제 #26
0
 public void testSetAndGetLastfmUserName() {
   final String value = "adkjhafklio3";
   assertFalse(value.equals(WAILSettings.getLastfmUserName(getContext())));
   WAILSettings.setLastfmUserName(getContext(), value);
   assertEquals(value, WAILSettings.getLastfmUserName(getContext()));
 }
예제 #27
0
 public void testSetAndGetMinTrackDurationInSeconds() {
   final int value = 124512;
   assertTrue(value != WAILSettings.getMinTrackDurationInSeconds(getContext()));
   WAILSettings.setMinTrackDurationInSeconds(getContext(), value);
   assertEquals(value, WAILSettings.getMinTrackDurationInSeconds(getContext()));
 }
예제 #28
0
 public void testIsShowFeedbackRequestDefault() {
   assertTrue(WAILSettings.isShowFeedbackRequest(getContext()));
 }
예제 #29
0
 public void testSetAndGetTotalHandledTracksCount() {
   final long value = 215;
   assertTrue(value != WAILSettings.getTotalHandledTracksCount(getContext()));
   WAILSettings.setTotalHandledTracksCount(getContext(), value);
   assertEquals(value, WAILSettings.getTotalHandledTracksCount(getContext()));
 }
예제 #30
0
 public void testSetAndGetIsLastfmNowplayingUpdateEnabled() {
   final boolean value = false;
   assertTrue(value != WAILSettings.isLastfmNowplayingUpdateEnabled(getContext()));
   WAILSettings.setLastfmNowplayingUpdateEnabled(getContext(), value);
   assertEquals(value, WAILSettings.isLastfmNowplayingUpdateEnabled(getContext()));
 }