BuildRequires: pkgconfig
BuildRequires: pkgconfig(wayland-server)
BuildRequires: pkgconfig(wayland-client)
+BuildRequires: pkgconfig(gmock)
# requires to build examples
%if "%{enable_examples}" == "1"
%description -n wayland-protocols
wayland-protocols contains Wayland upstream protocols that add functionality not available in the Wayland core protocol
+%package -n libwayland-extension-unittests
+Summary: Unit test cases for the libwayland-extension
+Group: Graphics & UI Framework/Development
+Requires: libwayland-client
+Requires: libwayland-server
+
+%description -n libwayland-extension-unittests
+Unit test cases for the libwayland-extension
%prep
%setup -q
%_datadir/wayland-extension/protocol/unstable/*
%_libdir/pkgconfig/wayland-protocols.pc
+%files -n libwayland-extension-unittests
+%defattr(-,root,root,-)
+%{_bindir}/libwayland-extension-unittests
+
%changelog
--- /dev/null
+bin_PROGRAMS = libwayland-extension-unittests
+
+libwayland_extension_unittests_SOURCES = \
+ tc-main.cpp
+
+libwayland_extension_unittests_CXXFLAGS = \
+ -I$(top_srcdir)/protocol/tizen \
+ ${CXXFLAGS} \
+ @GMOCK_CFLAGS@ \
+ @WAYLAND_SERVER_CFLAGS@ \
+ @WAYLAND_CLIENT_CFLAGS@
+
+libwayland_extension_unittests_LDFLAGS = \
+ ${LDFLAGS} \
+ @GMOCK_LIBS@ \
+ @WAYLAND_SERVER_LIBS@ \
+ @WAYLAND_CLIENT_LIBS@
+
+check:
+ ./libwayland-extension-unitests
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2020 Samsung Electronics co., Ltd. All Rights Reserved.
+ *
+ * Contact: SooChan Lim <sc1.lim@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+**************************************************************************/
+
+#include "gmock/gmock.h"
+
+int main(int argc, char **argv)
+{
+ auto AllTestSuccess = false;
+
+ try {
+ ::testing::InitGoogleMock(&argc, argv);
+ ::testing::FLAGS_gtest_death_test_style = "fast";
+ } catch ( ... ) {
+ std::cout << "error while trying to init google tests.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ try {
+ AllTestSuccess = RUN_ALL_TESTS() == 0 ? true : false;
+ } catch (const ::testing::internal::GoogleTestFailureException & e) {
+ AllTestSuccess = false;
+ std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
+ std::cout << "\n";
+ }
+
+ return AllTestSuccess;
+}