Changeset 940734d9cb1999a247cc4c60b96442c20e804413
- Timestamp:
- 03/29/08 00:38:32
(3 months ago)
- Author:
- Filippo Carone <littlejohn@videolan.org>
- git-committer:
- Filippo Carone <littlejohn@videolan.org> 1206747512 +0100
- git-parent:
[fea85dea108170c42f126e7937821c074384c8b5]
- git-author:
- Filippo Carone <littlejohn@videolan.org> 1206747474 +0100
- Message:
unit tests update
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r27bee6c |
r940734d |
|
| 41 | 41 | public void setup() |
|---|
| 42 | 42 | { |
|---|
| 43 | | jvlc = new JVLC(); |
|---|
| | 43 | jvlc = new JVLC("-vvv -I dummy --aout=dummy --vout=dummy"); |
|---|
| 44 | 44 | } |
|---|
| 45 | 45 | |
|---|
| r9c24ad3 |
r940734d |
|
| 41 | 41 | { |
|---|
| 42 | 42 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| 43 | | LibVlcInstance libvlcInstance = instance.libvlc_new(0, new String[] {}, exception); |
|---|
| | 43 | LibVlcInstance libvlcInstance = instance.libvlc_new(0, new String[] {"-I","dummy","--aout=dummy","--vout=dummy"}, exception); |
|---|
| 44 | 44 | Assert.assertNotNull(libvlcInstance); |
|---|
| 45 | 45 | Assert.assertEquals(0, exception.raised); |
|---|
| rbd2b348 |
r940734d |
|
| 51 | 51 | { |
|---|
| 52 | 52 | exception = new libvlc_exception_t(); |
|---|
| 53 | | libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception); |
|---|
| | 53 | libvlcInstance = libvlc.libvlc_new(0, new String[]{"-vvv","-I","dummy","-aout=dummy","-vout=dummy"}, exception); |
|---|
| 54 | 54 | libvlc.libvlc_exception_clear(exception); |
|---|
| 55 | 55 | } |
|---|
| r4459ae4 |
r940734d |
|
| 49 | 49 | { |
|---|
| 50 | 50 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| 51 | | libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception); |
|---|
| | 51 | libvlcInstance = libvlc.libvlc_new(0, new String[]{"-I","dummy","--aout=dummy","--vout=dummy"}, exception); |
|---|
| 52 | 52 | } |
|---|
| 53 | 53 | |
|---|
| r1ffcf6b |
r940734d |
|
| 25 | 25 | |
|---|
| 26 | 26 | package org.videolan.jvlc.internal; |
|---|
| 27 | | |
|---|
| 28 | | import java.io.File; |
|---|
| 29 | 27 | |
|---|
| 30 | 28 | import junit.framework.Assert; |
|---|
| … | … | |
| 54 | 52 | { |
|---|
| 55 | 53 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| 56 | | libvlcInstance = libvlc.libvlc_new(0, new String[]{"-A","file","--audiofile-file=" + File.createTempFile("jvlc", ".wav").getAbsolutePath()}, exception); |
|---|
| | 54 | libvlcInstance = libvlc.libvlc_new(0, new String[]{"-vvv","-I","dummy","--aout=dummy","--vout=dummy"}, exception); |
|---|
| 57 | 55 | // use the following line to use your audio card. |
|---|
| 58 | 56 | // libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception); |
|---|
| … | … | |
| 182 | 180 | Thread.sleep(150); |
|---|
| 183 | 181 | } |
|---|
| | 182 | // FIXME give stats the time to run... there's probably a race condition in misc/stats.c:259 that |
|---|
| | 183 | // needs to be fixed |
|---|
| | 184 | Thread.sleep(400); |
|---|
| 184 | 185 | libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception); |
|---|
| | 186 | libvlc.libvlc_media_list_player_release(mediaListPlayer); |
|---|
| | 187 | } |
|---|
| | 188 | |
|---|
| | 189 | @Test |
|---|
| | 190 | public void mediaListPlayerGetStateStopped() |
|---|
| | 191 | { |
|---|
| | 192 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| | 193 | LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception); |
|---|
| | 194 | int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception); |
|---|
| | 195 | Assert.assertEquals(LibVlcState.libvlc_Stopped.ordinal(), state); |
|---|
| 185 | 196 | } |
|---|
| 186 | 197 | |
|---|
| … | … | |
| 195 | 206 | libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception); |
|---|
| 196 | 207 | libvlc.libvlc_media_list_player_play_item(mediaListPlayer, mediaDescriptor, exception); |
|---|
| | 208 | while (true) |
|---|
| | 209 | { |
|---|
| | 210 | int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception); |
|---|
| | 211 | if (exception.raised == 1) |
|---|
| | 212 | { |
|---|
| | 213 | throw new RuntimeException("Native exception thrown"); |
|---|
| | 214 | } |
|---|
| | 215 | if (playing == 1) |
|---|
| | 216 | { |
|---|
| | 217 | break; |
|---|
| | 218 | } |
|---|
| | 219 | Thread.sleep(150); |
|---|
| | 220 | } |
|---|
| 197 | 221 | libvlc.libvlc_media_list_player_pause(mediaListPlayer, exception); |
|---|
| 198 | 222 | Assert.assertEquals(0, exception.raised); |
|---|
| … | … | |
| 213 | 237 | Assert.assertEquals("Expected state: " + LibVlcState.libvlc_Paused +".\n", LibVlcState.libvlc_Paused.ordinal(), state); |
|---|
| 214 | 238 | libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception); |
|---|
| 215 | | } |
|---|
| 216 | | |
|---|
| 217 | | @Test |
|---|
| 218 | | public void mediaListPlayerGetStateStopped() |
|---|
| 219 | | { |
|---|
| 220 | | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| 221 | | LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception); |
|---|
| 222 | | int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception); |
|---|
| 223 | | Assert.assertEquals(LibVlcState.libvlc_Stopped.ordinal(), state); |
|---|
| 224 | | } |
|---|
| | 239 | libvlc.libvlc_media_list_player_release(mediaListPlayer); |
|---|
| | 240 | } |
|---|
| | 241 | |
|---|
| 225 | 242 | |
|---|
| 226 | 243 | @Test |
|---|
| r5f584e4 |
r940734d |
|
| 48 | 48 | { |
|---|
| 49 | 49 | libvlc_exception_t exception = new libvlc_exception_t(); |
|---|
| 50 | | libvlcInstance = libvlc.libvlc_new(0, new String[]{}, exception); |
|---|
| | 50 | libvlcInstance = libvlc.libvlc_new(0, new String[]{"-I","dummy","--aout=dummy","--vout=dummy"}, exception); |
|---|
| 51 | 51 | } |
|---|
| 52 | 52 | |
|---|