[PATCH weston v0 08/11] Add a fadein test

Bryce Harrington bryce at osg.samsung.com
Sun Nov 9 13:41:24 PST 2014


This also serves as a proof of concept of the screen capture
functionality and as a demo for snapshot-based rendering verification.

Signed-off-by: Bryce Harrington <bryce at osg.samsung.com>
---
 Makefile.am         |  7 +++++-
 tests/fadein-test.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 tests/fadein-test.c

diff --git a/Makefile.am b/Makefile.am
index 26dd473..c3dfa10 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -852,7 +852,8 @@ weston_tests =					\
 	text.weston				\
 	presentation.weston			\
 	roles.weston				\
-	subsurface.weston
+	subsurface.weston			\
+	fadein.weston
 
 
 AM_TESTS_ENVIRONMENT = \
@@ -954,6 +955,10 @@ subsurface_weston_SOURCES = tests/subsurface-test.c
 subsurface_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 subsurface_weston_LDADD = libtest-client.la
 
+fadein_weston_SOURCES = tests/fadein-test.c
+fadein_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
+fadein_weston_LDADD = libtest-client.la
+
 presentation_weston_SOURCES = tests/presentation-test.c
 nodist_presentation_weston_SOURCES =		\
 	protocol/presentation_timing-protocol.c	\
diff --git a/tests/fadein-test.c b/tests/fadein-test.c
new file mode 100644
index 0000000..5b243bf
--- /dev/null
+++ b/tests/fadein-test.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright © 2014 Samsung
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of the copyright holders not be used in
+ * advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission.  The copyright holders make
+ * no representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+ * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "config.h"
+
+#include <unistd.h>
+#include <stdio.h>
+
+#include "weston-test-client-helper.h"
+
+char *server_parameters="--use-pixman --width=320 --height=240";
+
+static char*
+output_filename(const char* basename) {
+	static const char *path = "./";
+	char *filename;
+
+        if (asprintf(&filename, "%s%s", path, basename) < 0)
+		filename = NULL;
+
+	return filename;
+}
+
+TEST(headless)
+{
+	struct client *client;
+	char basename[32];
+	char *out_path;
+	int i;
+
+	client = client_create(100, 100, 100, 100);
+	assert(client);
+
+	for (i = 0; i < 6; i++) {
+		snprintf(basename, sizeof basename, "fadein-%02d", i);
+		out_path = output_filename(basename);
+
+		wl_test_record_screenshot(client->test->wl_test, out_path);
+		client_roundtrip(client);
+		free (out_path);
+
+		usleep(250000);
+	}
+
+}
-- 
1.9.1



More information about the wayland-devel mailing list