tests: make vertex-clip use WESTON_EXPORT_FOR_TESTS

This is probably the simplest case to demonstrate how to use
WESTON_EXPORT_FOR_TESTS.

Previously, vertex-clip test re-built vertex-clipping.c for itself. Now
it directly links in gl-renderer.so instead as that is where
vexter-clipping.c gets built into for actual use. This probably will not
work for any installed program, but luckily tests are never installed,
so Meson makes sure the DSO is found.

Unfortunately we cannot remove the definition of dep_vertex_clipping
yet, because clients/cliptest.c needs it.

This makes vertex-clip test depend on GL-renderer, but that is where the
code is really used.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 3 years ago committed by Pekka Paalanen
parent 32a790f774
commit e2ee2b56f9
  1. 7
      libweston/vertex-clipping.c
  2. 13
      tests/meson.build

@ -26,9 +26,10 @@
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>
#include "shared/helpers.h"
#include "vertex-clipping.h" #include "vertex-clipping.h"
float WESTON_EXPORT_FOR_TESTS float
float_difference(float a, float b) float_difference(float a, float b)
{ {
/* http://www.altdevblogaday.com/2012/02/22/comparing-floating-point-numbers-2012-edition/ */ /* http://www.altdevblogaday.com/2012/02/22/comparing-floating-point-numbers-2012-edition/ */
@ -282,7 +283,7 @@ clip_polygon_bottom(struct clip_context *ctx, const struct polygon8 *src,
#define min(a, b) (((a) > (b)) ? (b) : (a)) #define min(a, b) (((a) > (b)) ? (b) : (a))
#define clip(x, a, b) min(max(x, a), b) #define clip(x, a, b) min(max(x, a), b)
int WESTON_EXPORT_FOR_TESTS int
clip_simple(struct clip_context *ctx, clip_simple(struct clip_context *ctx,
struct polygon8 *surf, struct polygon8 *surf,
float *ex, float *ex,
@ -296,7 +297,7 @@ clip_simple(struct clip_context *ctx,
return surf->n; return surf->n;
} }
int WESTON_EXPORT_FOR_TESTS int
clip_transformed(struct clip_context *ctx, clip_transformed(struct clip_context *ctx,
struct polygon8 *surf, struct polygon8 *surf,
float *ex, float *ex,

@ -204,10 +204,6 @@ tests = [
input_timestamps_unstable_v1_protocol_c, input_timestamps_unstable_v1_protocol_c,
], ],
}, },
{
'name': 'vertex-clip',
'dep_objs': dep_vertex_clipping,
},
{ 'name': 'viewporter', }, { 'name': 'viewporter', },
{ 'name': 'viewporter-shot', }, { 'name': 'viewporter-shot', },
{ {
@ -227,6 +223,14 @@ tests = [
}, },
] ]
if get_option('renderer-gl')
tests += {
'name': 'vertex-clip',
'link_with': plugin_gl,
}
endif
if get_option('color-management-lcms') if get_option('color-management-lcms')
dep_lcms2 = dependency('lcms2', version: '>= 2.9', required: false) dep_lcms2 = dependency('lcms2', version: '>= 2.9', required: false)
if not dep_lcms2.found() if not dep_lcms2.found()
@ -338,6 +342,7 @@ foreach t : tests
build_by_default: true, build_by_default: true,
include_directories: common_inc, include_directories: common_inc,
dependencies: t_deps, dependencies: t_deps,
link_with: t.get('link_with', []),
install: false, install: false,
) )

Loading…
Cancel
Save