Changeset e489a0531c3b03d8ea7f751736bd93f680050428

Show
Ignore:
Timestamp:
04/19/08 23:26:36 (5 months ago)
Author:
Filippo Carone <littlejohn@videolan.org>
git-committer:
Filippo Carone <littlejohn@videolan.org> 1208640396 +0200
git-parent:

[b11361df8b20c8d27f2f0939bcf83f7a342212ff]

git-author:
Filippo Carone <littlejohn@videolan.org> 1208640396 +0200
Message:

test code fix

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bindings/java/core/src/test/java/org/videolan/jvlc/internal/MediaListPlayerTest.java

    reeb354f re489a05  
    5252    { 
    5353        libvlc_exception_t exception = new libvlc_exception_t(); 
    54         libvlcInstance = libvlc.libvlc_new(0, new String[]{"-vvv","-I","dummy","--aout=dummy","--vout=dummy"}, exception); 
     54        libvlcInstance = libvlc.libvlc_new(0, new String[]{"-I", "dummy", "--aout=dummy", "--vout=dummy" }, exception); 
    5555        // use the following line to use your audio card. 
    5656        // libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception); 
     
    123123     * this fails: see https://trac.videolan.org/vlc/ticket/1527 
    124124     */ 
    125 //    @Test 
     125    // @Test 
    126126    public void mediaListPlayerPlay() 
    127127    { 
     
    134134        libvlc.libvlc_media_list_player_play(mediaListPlayer, exception); 
    135135        Assert.assertEquals("Exception message: " + exception.message + ".\n", 0, exception.raised); 
     136        libvlc.libvlc_media_release(mediaDescriptor); 
    136137        libvlc.libvlc_media_list_release(mediaList); 
    137138        libvlc.libvlc_media_list_player_release(mediaListPlayer); 
     
    162163        } 
    163164        libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception); 
    164         libvlc.libvlc_media_list_release(mediaList); 
    165         libvlc.libvlc_media_list_player_release(mediaListPlayer); 
    166  
     165        libvlc.libvlc_media_release(mediaDescriptor); 
     166        libvlc.libvlc_media_list_release(mediaList); 
     167        libvlc.libvlc_media_list_player_release(mediaListPlayer); 
    167168    } 
    168169 
     
    193194        // FIXME give stats the time to run... there's probably a race condition in misc/stats.c:259 that 
    194195        // needs to be fixed 
    195         Thread.sleep(400); 
     196        // Thread.sleep(400); 
    196197        libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception); 
    197198        libvlc.libvlc_media_list_release(mediaList); 
     
    210211 
    211212    @Test 
    212     public void mediaListPlayerPause() throws Exception 
     213    public void mediaLtistPlayerPause() throws Exception 
    213214    { 
    214215        libvlc_exception_t exception = new libvlc_exception_t(); 
     
    225226            { 
    226227                throw new RuntimeException("Native exception thrown"); 
    227             }             
     228            } 
    228229            if (playing == 1) 
    229230            { 
     
    233234        } 
    234235        libvlc.libvlc_media_list_player_pause(mediaListPlayer, exception); 
    235         Assert.assertEquals(0, exception.raised); 
     236        Assert.assertEquals(exception.message, 0, exception.raised); 
    236237        while (true) 
    237238        { 
     
    240241            { 
    241242                throw new RuntimeException("Native exception thrown"); 
    242             }             
     243            } 
    243244            if (playing == 0) 
    244245            { 
     
    248249        } 
    249250        int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception); 
    250         Assert.assertEquals("Expected state: " + LibVlcState.libvlc_Paused +".\n", LibVlcState.libvlc_Paused.ordinal(), state); 
     251        Assert.assertEquals(exception.message, 0, exception.raised); 
     252        Assert.assertEquals( 
     253            "Expected state: " + LibVlcState.libvlc_Paused + ".\n", 
     254            LibVlcState.libvlc_Paused.ordinal(), 
     255            state); 
    251256        libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception); 
    252257        libvlc.libvlc_media_list_release(mediaList); 
     
    254259    } 
    255260 
    256      
    257261    @Test 
    258262    public void mediaListPlayerSetMediaInstance() 
     
    265269        Assert.assertEquals(0, exception.raised); 
    266270    } 
    267      
     271 
    268272    @Test 
    269273    public void mediaListPlayerNextNoItems() 
     
    274278        Assert.assertEquals(1, exception.raised); 
    275279    } 
    276      
     280 
    277281    /** 
    278282     * fails, see https://trac.videolan.org/vlc/ticket/1535 
    279283     */ 
    280 //    @Test 
     284    // @Test 
    281285    public void mediaListPlayerNext() throws Exception 
    282286    { 
     
    308312        while (true) 
    309313        { 
    310             int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception); 
     314            int playing = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception); 
    311315            Assert.assertEquals(0, exception.raised); 
    312             if (playing == 1) 
    313             { 
    314                 break; 
    315             } 
    316             Thread.sleep(150); 
    317         } 
    318         Assert.assertEquals("Expected state: " + LibVlcState.libvlc_Playing +".\n", LibVlcState.libvlc_Playing.ordinal(), libvlc.libvlc_media_list_player_get_state( 
    319             mediaListPlayer, 
    320             exception)); 
    321          
     316            if (playing == LibVlcState.libvlc_Playing.ordinal()) 
     317            { 
     318                break; 
     319            } 
     320            Thread.sleep(150); 
     321        } 
     322 
    322323        libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception); 
    323324        while (true) 
     
    337338    } 
    338339 
    339  
    340  
    341340}