Example #1
0
  @Test
  public void queryThirdArtistSongWithMultipleArtistsTest() {
    Uri uri =
        MediaContract.Songs.buildArtistSongsListUri(
            hostInfo.getId(), TestValues.SongWithMultipleArtists.thirdArtistId);

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

    assertNotNull(cursor);
    assertEquals("cursor size ", 1, cursor.getCount());
    assertTrue(cursor.moveToFirst());
    TestValues.SongWithMultipleArtists.test(cursor);
  }
Example #2
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);
  }