Commit cc838150 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

libvlc-control smoke test. Feel free to extend

parent 255cdb14
......@@ -351,7 +351,7 @@ misc/revision.c:
###############################################################################
# Unit/regression test
###############################################################################
check_PROGRAMS = test_i18n_atof test_url test_utf8
check_PROGRAMS = test_i18n_atof test_url test_utf8 test_control
TESTS = $(check_PROGRAMS)
CFLAGS_tests = `$(VLC_CONFIG) --cflags libvlc`
......@@ -367,6 +367,10 @@ test_utf8_SOURCES = test/utf8.c
test_utf8_LDADD = libvlc.la
test_utf8_CFLAGS = $(CFLAGS_tests)
test_control_SOURCES = control/testapi.c
test_control_LDADD = libvlc-control.la
test_control_CFLAGS = $(CFLAGS_tests)
FORCE:
@echo "Generated source cannot be phony. Go away." >&2
@exit 1
......
/*
* testapi.c - libvlc-control smoke test
*
* $Id$
*/
/**********************************************************************
* Copyright (C) 2007 Rémi Denis-Courmont. *
* This program is free software; you can redistribute and/or modify *
* it under the terms of the GNU General Public License as published *
* by the Free Software Foundation; version 2 of the license, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, you can get it from: *
* http://www.gnu.org/copyleft/gpl.html *
**********************************************************************/
#include <vlc/mediacontrol.h>
#include <assert.h>
int main (int argc, char *argv[])
{
mediacontrol_Exception ex;
mediacontrol_Instance *mc, *mc2;
libvlc_instance_t *vlc;
mediacontrol_exception_init (&ex);
mc = mediacontrol_new (argc, argv, &ex);
assert (mc);
assert (!ex.code);
mediacontrol_exception_cleanup (&ex);
/* Duplication test */
vlc = mediacontrol_get_libvlc_instance (mc);
assert (vlc);
assert (!ex.code);
mediacontrol_exception_init (&ex);
mc2 = mediacontrol_new_from_instance (vlc, &ex);
assert (mc2);
assert (!ex.code);
mediacontrol_exception_cleanup (&ex);
//mediacontrol_exit (mc2);
/* Input tests */
mediacontrol_exception_init (&ex);
mediacontrol_resume (mc, NULL, &ex);
assert (ex.code); /* should fail: we have no input */
mediacontrol_exception_cleanup (&ex);
mediacontrol_exception_init (&ex);
mediacontrol_pause (mc, NULL, &ex);
assert (ex.code); /* should fail: we have no input */
mediacontrol_exception_cleanup (&ex);
mediacontrol_exception_init (&ex);
mediacontrol_stop (mc, NULL, &ex);
mediacontrol_exception_cleanup (&ex);
/* Playlist tests */
mediacontrol_exception_init (&ex);
mediacontrol_playlist_clear (mc, &ex);
assert (!ex.code);
mediacontrol_exception_cleanup (&ex);
mediacontrol_exception_init (&ex);
mediacontrol_playlist_add_item (mc, "/dev/null", &ex);
mediacontrol_exception_cleanup (&ex);
mediacontrol_exception_init (&ex);
mediacontrol_playlist_clear (mc, &ex);
assert (!ex.code);
mediacontrol_exception_cleanup (&ex);
mediacontrol_exit (mc);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment