-SUBDIRS = src
+SUBDIRS = src src/efl
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AC_PREREQ([2.64])
AC_INIT([wayland-test],
- [0.89],
+ [0.95],
[https://bugs.freedesktop.org/enter_bug.cgi?product=wayland],
[wayland-test],
[http://wayland.freedesktop.org/])
PKG_CHECK_MODULES(CAIRO, [cairo >= 1.10.0])
PKG_CHECK_MODULES(WAYLAND, [wayland-client wayland-egl])
+PKG_CHECK_MODULES(EFL, [elementary ecore evas], [have_efl=yes], [have_efl=no])
+AM_CONDITIONAL(BUILD_EFL_TESTS, test x$have_efl = xyes)
AC_CONFIG_FILES([Makefile
- src/Makefile])
+ src/Makefile
+ src/efl/Makefile])
AC_OUTPUT
TESTS = wayland-test
TESTS_ENVIRONMENT = $(SHELL) test-harness
-CXXFLAGS = -std=gnu++0x $(CAIRO_CFLAGS) $(WAYLAND_CFLAGS)
+CXXFLAGS = \
+ -std=gnu++0x \
+ $(CAIRO_CFLAGS) \
+ $(WAYLAND_CFLAGS)
+
LDFLAGS = \
$(CAIRO_LIBS) \
$(WAYLAND_LIBS) \
wayland_test_SOURCES = \
test_bind_interface.cpp \
testmain.cpp
+
+wayland_test_CXXFLAGS = -DTESTLOG='"@abs_builddir@/wayland-test.log"'
--- /dev/null
+
+if BUILD_EFL_TESTS
+
+TESTS = wayland-efl-test
+TESTS_ENVIRONMENT = $(SHELL) ../test-harness
+
+CXXFLAGS += \
+ -std=gnu++0x \
+ $(CAIRO_CFLAGS) \
+ $(WAYLAND_CFLAGS) \
+ @EFL_CFLAGS@
+
+LDFLAGS += \
+ $(CAIRO_LIBS) \
+ $(WAYLAND_LIBS) \
+ @EFL_LIBS@ \
+ -lboost_unit_test_framework
+
+bin_PROGRAMS = $(TESTS)
+
+wayland_efl_test_SOURCES = \
+ application.cpp \
+ window.cpp \
+ test_window_size.cpp \
+ test_engine_set.cpp \
+ ../testmain.cpp
+
+wayland_efl_test_CXXFLAGS = -DTESTLOG='"@abs_builddir@/wayland-efl-test.log"'
+
+endif
--- /dev/null
+#include <Elementary.h>
+
+#include "../test.h"
+#include "application.h"
+
+Application::Application()
+{
+ elm_init(
+ boost::unit_test::framework::master_test_suite().argc,
+ boost::unit_test::framework::master_test_suite().argv
+ );
+ setEngine(ENGINE_SHM);
+}
+
+/* virtual */
+Application::~Application()
+{
+ // FIXME: hmmm... doesn't behave nicely across muliple boost test instances
+ elm_shutdown();
+}
+
+void Application::setEngine(const Engine& engine)
+{
+ std::string strEngine = "software_x11";
+ switch (engine) {
+ case ENGINE_EGL:
+ strEngine = "wayland_egl";
+ break;
+ case ENGINE_SHM:
+ default:
+ strEngine = "wayland_shm";
+ }
+
+ elm_config_preferred_engine_set(strEngine.c_str()); // override's ELM_ENGINE user environment setting
+ elm_config_engine_set(strEngine.c_str());
+ BOOST_ASSERT(strEngine == std::string(elm_config_preferred_engine_get()));
+ BOOST_ASSERT(strEngine == std::string(elm_config_engine_get()));
+}
+
+void Application::mainLoop()
+{
+ elm_run();
+}
+
+void Application::yield()
+{
+ ecore_main_loop_iterate();
+ sleep(1);
+}
+
+void Application::exit()
+{
+ elm_exit();
+}
--- /dev/null
+#ifndef __WAYLAND_EFL_APPLICATION_H__
+#define __WAYLAND_EFL_APPLICATION_H__
+
+class Application
+{
+public:
+ enum Engine {
+ ENGINE_SHM,
+ ENGINE_EGL
+ };
+
+ Application();
+ virtual ~Application();
+
+ void setEngine(const Engine&);
+ void mainLoop();
+ void yield();
+ void exit();
+};
+
+#endif
--- /dev/null
+#include <Elementary.h>
+#include "../test.h"
+
+BOOST_AUTO_TEST_CASE(elm_engine_set_wayland_shm)
+{
+ elm_init(
+ boost::unit_test::framework::master_test_suite().argc,
+ boost::unit_test::framework::master_test_suite().argv
+ );
+ elm_config_engine_set("wayland_shm");
+ BOOST_CHECK_EQUAL("wayland_shm", elm_config_engine_get());
+}
+
+BOOST_AUTO_TEST_CASE(elm_engine_set_wayland_egl)
+{
+ elm_init(
+ boost::unit_test::framework::master_test_suite().argc,
+ boost::unit_test::framework::master_test_suite().argv
+ );
+ elm_config_engine_set("wayland_egl");
+ BOOST_CHECK_EQUAL("wayland_egl", elm_config_engine_get());
+}
--- /dev/null
+#include <Elementary.h>
+#include <Ecore.h>
+
+#include "application.h"
+#include "window.h"
+#include "../test.h"
+
+BOOST_AUTO_TEST_CASE(efl_window_size_shm)
+{
+ Application app;
+ app.setEngine(Application::ENGINE_SHM);
+ Window win("shm-size", "SHM Size");
+ win.setSize(400, 400);
+ win.setPosition(0, 0);
+ win.show();
+
+ app.yield();
+
+ BOOST_CHECK_EQUAL(win.getWidth(), 400);
+ BOOST_CHECK_EQUAL(win.getHeight(), 400);
+}
+
+BOOST_AUTO_TEST_CASE(efl_window_size_egl)
+{
+ Application app;
+ app.setEngine(Application::ENGINE_EGL);
+ Window win("egl-size", "EGL Size");
+ win.setSize(400, 400);
+ win.setPosition(0, 0);
+ win.show();
+
+ app.yield();
+
+ BOOST_CHECK_EQUAL(win.getWidth(), 400);
+ BOOST_CHECK_EQUAL(win.getHeight(), 400);
+}
+
--- /dev/null
+#include <Elementary.h>
+
+#include "window.h"
+
+Window::Window(const std::string& name, const std::string& title)
+{
+ win_ = elm_win_util_standard_add(name.c_str(), title.c_str());
+}
+
+/* virtual */
+Window::~Window()
+{
+ win_ = NULL;
+}
+
+void Window::setSize(int w, int h)
+{
+ evas_object_resize(win_, w, h);
+}
+
+void Window::setPosition(int x, int y)
+{
+ evas_object_move(win_, x, y);
+}
+
+void Window::show()
+{
+ evas_object_show(win_);
+}
+
+int Window::getWidth()
+{
+ int x, y, w, h;
+ evas_object_geometry_get(win_, &x, &y, &w, &h);
+ return w;
+}
+
+int Window::getHeight()
+{
+ int x, y, w, h;
+ evas_object_geometry_get(win_, &x, &y, &w, &h);
+ return h;
+}
--- /dev/null
+#ifndef __WAYLAND_EFL_WINDOW_H__
+#define __WAYLAND_EFL_WINDOW_H__
+
+#include <string>
+
+// typename Evas_Object;
+
+class Window
+{
+public:
+ Window(const std::string&, const std::string&);
+ virtual ~Window();
+
+ void setSize(int w, int h);
+ void setPosition(int x, int y);
+ void show();
+
+ int getWidth();
+ int getHeight();
+private:
+ Evas_Object* win_;
+};
+
+#endif
#!/bin/sh
-RESULT_LOG=${1}.xml
-
-rm -rf ${RESULT_LOG}
-
$WLD/install/bin/weston & sleep 2 # allow time for weston to initialize
-${1} --log_level=all --log_format=xml --report_level=detailed > ${RESULT_LOG}
+${1} --log_level=all --log_format=xml --report_level=detailed
RESULT=$?
kill -15 %1
-if [ -f ${RESULT_LOG} ]
-then
- xmllint ${RESULT_LOG} --format -o ${RESULT_LOG}
- echo "See full results in `readlink -f ${RESULT_LOG}`"
-fi
-
exit ${RESULT}
\ No newline at end of file
#define TESTING_PROGRAM
#define BOOST_AUTO_TEST_MAIN
+#include <fstream>
#include "test.h"
+
+
+/**
+ *
+ * See http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/index.html
+ *
+ */
+
+struct GlobalFixture
+{
+ GlobalFixture()
+ {
+ std::string log(TESTLOG);
+ if (getenv("TESTS_LOGFILE"))
+ {
+ log = std::string(getenv("TESTS_LOGFILE"));
+ }
+ testLog = new std::ofstream(log);
+ boost::unit_test::unit_test_log.set_stream( *testLog );
+ }
+
+ ~GlobalFixture()
+ {
+ return;
+ }
+
+ static std::ofstream* testLog;
+};
+
+std::ofstream* GlobalFixture::testLog;
+
+BOOST_GLOBAL_FIXTURE( GlobalFixture );
\ No newline at end of file