예제 #1
0
  @Test
  public void queryAllAlbumsTest() {
    Uri uri = MediaContract.Albums.buildAlbumsListUri(hostInfo.getId());

    Cursor cursor = contentResolver.query(uri, TestValues.Album.PROJECTION, null, null, null);

    assertNotNull(cursor);
    assertEquals("cursor size ", 232, cursor.getCount());
    int columnIndex = cursor.getColumnIndex(MediaContract.AlbumsColumns.ALBUMID);
    TestUtils.testCursorContainsRange(cursor, columnIndex, 1, 75);
    TestUtils.testCursorContainsRange(cursor, columnIndex, 77, 82);
    TestUtils.testCursorContainsRange(cursor, columnIndex, 84, 234);
  }
예제 #2
0
  @Test
  public void queryAllArtistsTest() {
    Uri uri = MediaContract.Artists.buildArtistsListUri(hostInfo.getId());

    Cursor cursor = contentResolver.query(uri, TestValues.Artist.PROJECTION, null, null, null);

    assertNotNull(cursor);
    assertEquals("cursor size ", 227, cursor.getCount());
    TestUtils.testCursorContainsRange(
        cursor, cursor.getColumnIndex(MediaContract.ArtistsColumns.ARTISTID), 1, 94);
    // Artist id 95 should be missing
    TestUtils.testCursorContainsRange(
        cursor, cursor.getColumnIndex(MediaContract.ArtistsColumns.ARTISTID), 96, 228);
  }
예제 #3
0
  @Test
  public void queryAlbumsForGenreTest() {
    int genreId = 13;
    Uri uri = MediaContract.AlbumGenres.buildAlbumsForGenreListUri(hostInfo.getId(), genreId);

    Cursor cursor = contentResolver.query(uri, TestValues.Album.PROJECTION, null, null, null);

    assertNotNull(cursor);
    assertEquals("cursor size ", 31, cursor.getCount());
    TestUtils.testCursorContainsNumbers(
        cursor, cursor.getColumnIndex(MediaContract.Albums.ALBUMID), 28, 43, 47, 66, 100);
    TestUtils.testCursorContainsRange(
        cursor, cursor.getColumnIndex(MediaContract.Albums.ALBUMID), 50, 55);
    TestUtils.testCursorContainsRange(
        cursor, cursor.getColumnIndex(MediaContract.Albums.ALBUMID), 201, 220);
  }
예제 #4
0
  @Test
  public void queryAllGenresTest() {
    Uri uri = MediaContract.AudioGenres.buildAudioGenresListUri(hostInfo.getId());

    Cursor cursor =
        contentResolver.query(
            uri, new String[] {MediaContract.AudioGenresColumns.GENREID}, null, null, null);

    assertNotNull(cursor);
    assertEquals("cursor size ", 39, cursor.getCount());
    TestUtils.testCursorContainsRange(
        cursor, cursor.getColumnIndex(MediaContract.AudioGenresColumns.GENREID), 1, 39);
  }
예제 #5
0
  @Test
  public void queryAlbumSongsTest() {
    Uri uri =
        MediaContract.Songs.buildAlbumSongsListUri(hostInfo.getId(), TestValues.Album.albumId);

    Cursor cursor =
        contentResolver.query(uri, new String[] {MediaContract.Songs.SONGID}, null, null, null);

    assertNotNull(cursor);
    assertEquals("cursor size ", 17, cursor.getCount());
    TestUtils.testCursorContainsRange(
        cursor, cursor.getColumnIndex(MediaContract.SongsColumns.SONGID), 96, 112);
  }
예제 #6
0
  @Test
  public void queryArtistSongsTest() {
    Uri uri =
        MediaContract.Songs.buildArtistSongsListUri(
            hostInfo.getId(), TestValues.ArtistSong.artistId);

    Cursor cursor = contentResolver.query(uri, TestValues.ArtistSong.PROJECTION, null, null, null);

    assertNotNull(cursor);
    assertEquals("cursor size ", 17, cursor.getCount());
    TestUtils.testCursorContainsRange(
        cursor, cursor.getColumnIndex(MediaContract.SongsColumns.SONGID), 96, 112);
    assertTrue(
        Utils.moveCursorTo(
            cursor,
            cursor.getColumnIndex(MediaContract.Songs.SONGID),
            TestValues.ArtistSong.songId));
  }
예제 #7
0
  @Test
  public void queryAllSongsTest() {
    Uri uri = MediaContract.Songs.buildSongsListUri(hostInfo.getId());

    Cursor cursor = contentResolver.query(uri, TestValues.ArtistSong.PROJECTION, null, null, null);

    assertNotNull(cursor);
    assertEquals("cursor size ", 1804, cursor.getCount());
    TestUtils.testCursorContainsRange(
        cursor, cursor.getColumnIndex(MediaContract.Songs.SONGID), 1, 1804);

    // Test if list also contains a song WITH an album AND an artist
    assertTrue(
        Utils.moveCursorTo(
            cursor,
            cursor.getColumnIndex(MediaContract.Songs.SONGID),
            TestValues.SongWithAlbumAndArtist.songId));
    TestValues.SongWithAlbumAndArtist.test(cursor);

    // Test if list also contains a song WITHOUT an album but WITH an artist
    assertTrue(
        Utils.moveCursorTo(
            cursor,
            cursor.getColumnIndex(MediaContract.Songs.SONGID),
            TestValues.SongWithArtistWithoutAlbum.songId));
    TestValues.SongWithArtistWithoutAlbum.test(cursor);

    // Test if list also contains a song WITH an album but WITHOUT an artist
    assertTrue(
        Utils.moveCursorTo(
            cursor,
            cursor.getColumnIndex(MediaContract.Songs.SONGID),
            TestValues.SongWithAlbumWithoutArtist.songId));
    TestValues.SongWithAlbumWithoutArtist.test(cursor);

    // Test if list contains a song WITH MULTIPLE artists
    assertTrue(
        Utils.moveCursorTo(
            cursor,
            cursor.getColumnIndex(MediaContract.Songs.SONGID),
            TestValues.SongWithMultipleArtists.songId));
    TestValues.SongWithMultipleArtists.test(cursor);
  }