--- server/tests/Makefile.am | 1 + server/tests/spice-codecs-parsing-test.c | 60 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 server/tests/spice-codecs-parsing-test.c diff --git a/server/tests/Makefile.am b/server/tests/Makefile.am index 8580a9a..37b9f88 100644 --- a/server/tests/Makefile.am +++ b/server/tests/Makefile.am @@ -37,6 +37,7 @@ LDADD = \ $(NULL) check_PROGRAMS = \ + spice-codecs-parsing-test \ spice-options-test \ stat_test \ stream-test \ diff --git a/server/tests/spice-codecs-parsing-test.c b/server/tests/spice-codecs-parsing-test.c new file mode 100644 index 0000000..48a8ef9 --- /dev/null +++ b/server/tests/spice-codecs-parsing-test.c @@ -0,0 +1,60 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +/* + Copyright (C) 2016 Red Hat, Inc. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see <http://www.gnu.org/licenses/>. +*/ +#include <config.h> +#include <glib.h> +#include <spice.h> + +/* GLIB_CHECK_VERSION(2, 40, 0) */ +#ifndef g_assert_nonnull +#define g_assert_nonnull g_assert +#endif + +static void codecs_good(void) +{ + guint i; + const gchar *codecs[] = { + "", + "spice:mjpeg", + "spice:mjpeg;;;", + "spice:mjpeg;;spice:mjpeg;;;", + ";;spice:mjpeg;;spice:mjpeg;;;", +#if defined(HAVE_GSTREAMER_1_0) || defined(HAVE_GSTREAMER_0_10) + "gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8;", + ";;spice:mjpeg;;gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8;", +#endif + }; + + SpiceServer *server = spice_server_new(); + + g_assert_nonnull(server); + + for (i = 0; i < G_N_ELEMENTS(codecs); ++i) { + g_assert_cmpint(spice_server_set_video_codecs(server, codecs[i]), ==, 0); + } + + spice_server_destroy(server); +} + +int main(int argc, char *argv[]) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/server/codecs good", codecs_good); + + return g_test_run(); +} -- 2.10.2 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel