Changeset 1c5df1f36c6a04f86f4cecaa3d08be69f1dfc6bd

Show
Ignore:
Timestamp:
04/01/08 00:16:40 (5 months ago)
Author:
Filippo Carone <littlejohn@videolan.org>
git-committer:
Filippo Carone <littlejohn@videolan.org> 1207001800 +0200
git-parent:

[0bf9167869df1e1ca6ed9a32a8b220f02ed80ddc]

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

new (failing) test for libvlc

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/control/testapi.c

    r8518a86 r1c5df1f  
    6868static void test_events (const char ** argv, int argc); 
    6969static void test_media_player_play_stop(const char** argv, int argc); 
     70static void test_media_player_pause_stop(const char** argv, int argc); 
     71static void test_media_list_player_pause_stop(const char** argv, int argc); 
    7072 
    7173/* Tests implementations */ 
     
    357359} 
    358360 
     361static void test_media_player_pause_stop(const char** argv, int argc) 
     362{ 
     363    libvlc_instance_t *vlc; 
     364    libvlc_media_t *md; 
     365    libvlc_media_player_t *mi; 
     366    const char * file = "file://../bindings/java/core/src/test/resources/raffa_voice.ogg"; 
     367 
     368    log ("Testing play and pause of %s\n", file); 
     369 
     370    libvlc_exception_init (&ex); 
     371    vlc = libvlc_new (argc, argv, &ex); 
     372    catch (); 
     373 
     374    md = libvlc_media_new (vlc, file, &ex); 
     375    catch (); 
     376 
     377    mi = libvlc_media_player_new_from_media (md, &ex); 
     378    catch (); 
     379     
     380    libvlc_media_release (md); 
     381 
     382    libvlc_media_player_play (mi, &ex); 
     383    catch (); 
     384 
     385    /* FIXME: Do something clever */ 
     386    sleep(1); 
     387 
     388    assert( libvlc_media_player_get_state (mi, &ex) == libvlc_Playing ); 
     389    catch (); 
     390 
     391    libvlc_media_player_pause (mi, &ex); 
     392    assert( libvlc_media_player_get_state (mi, &ex) == libvlc_Paused ); 
     393    catch(); 
     394 
     395    libvlc_media_player_stop (mi, &ex); 
     396    catch (); 
     397 
     398    libvlc_media_player_release (mi); 
     399    catch (); 
     400 
     401    libvlc_release (vlc); 
     402    catch (); 
     403} 
     404 
     405static void test_media_list_player_pause_stop(const char** argv, int argc) 
     406{ 
     407    libvlc_instance_t *vlc; 
     408    libvlc_media_t *md; 
     409    libvlc_media_player_t *mi; 
     410    libvlc_media_list_t *ml; 
     411    libvlc_media_list_player_t *mlp; 
     412     
     413    const char * file = "file://../bindings/java/core/src/test/resources/raffa_voice.ogg"; 
     414 
     415    log ("Testing play and pause of %s using the media list.\n", file); 
     416 
     417    libvlc_exception_init (&ex); 
     418    vlc = libvlc_new (argc, argv, &ex); 
     419    catch (); 
     420 
     421    md = libvlc_media_new (vlc, file, &ex); 
     422    catch (); 
     423 
     424    ml = libvlc_media_list_new (vlc, &ex); 
     425    catch (); 
     426     
     427    mlp = libvlc_media_list_player_new (vlc, &ex); 
     428 
     429    libvlc_media_list_add_media( ml, md, &ex ); 
     430    catch (); 
     431 
     432    libvlc_media_list_player_set_media_list( mlp, ml, &ex ); 
     433 
     434    libvlc_media_list_player_play_item( mlp, md, &ex ); 
     435 
     436    /* FIXME: Do something clever */ 
     437    sleep(1); 
     438 
     439    assert( libvlc_media_player_get_state (mi, &ex) == libvlc_Playing ); 
     440    catch (); 
     441 
     442    libvlc_media_player_pause (mi, &ex); 
     443    assert( libvlc_media_player_get_state (mi, &ex) == libvlc_Paused ); 
     444    catch(); 
     445 
     446    libvlc_media_player_stop (mi, &ex); 
     447    catch (); 
     448 
     449    libvlc_media_player_release (mi); 
     450    catch (); 
     451 
     452    libvlc_release (vlc); 
     453    catch (); 
     454} 
     455 
     456 
     457 
    359458int main (int argc, char *argv[]) 
    360459{ 
     
    381480    test_media_player_play_stop(args, nlibvlc_args); 
    382481 
     482    test_media_player_pause_stop(args, nlibvlc_args); 
     483 
     484    test_media_list_player_pause_stop(args, nlibvlc_args); 
     485     
    383486    return 0; 
    384487}