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>
This commit is contained in:
Pekka Paalanen 2022-02-17 14:37:03 +02:00 committed by Pekka Paalanen
parent 32a790f774
commit e2ee2b56f9
2 changed files with 13 additions and 7 deletions

View file

@ -26,9 +26,10 @@
#include <float.h>
#include <math.h>
#include "shared/helpers.h"
#include "vertex-clipping.h"
float
WESTON_EXPORT_FOR_TESTS float
float_difference(float a, float b)
{
/* 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 clip(x, a, b) min(max(x, a), b)
int
WESTON_EXPORT_FOR_TESTS int
clip_simple(struct clip_context *ctx,
struct polygon8 *surf,
float *ex,
@ -296,7 +297,7 @@ clip_simple(struct clip_context *ctx,
return surf->n;
}
int
WESTON_EXPORT_FOR_TESTS int
clip_transformed(struct clip_context *ctx,
struct polygon8 *surf,
float *ex,

View file

@ -204,10 +204,6 @@ tests = [
input_timestamps_unstable_v1_protocol_c,
],
},
{
'name': 'vertex-clip',
'dep_objs': dep_vertex_clipping,
},
{ 'name': 'viewporter', },
{ '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')
dep_lcms2 = dependency('lcms2', version: '>= 2.9', required: false)
if not dep_lcms2.found()
@ -338,6 +342,7 @@ foreach t : tests
build_by_default: true,
include_directories: common_inc,
dependencies: t_deps,
link_with: t.get('link_with', []),
install: false,
)