mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2025-12-20 03:30:19 +01:00
tests: Port all test clients to the new test asserts
This commit gets rid of libc's abort() usage in the test suite using test asserts instead. Asserts run in the server as plugins aren't converted because they are shared between server and client. Co-authored-by: Daniel Stone <daniels@collabora.com> Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
This commit is contained in:
parent
d92560a0e4
commit
c855bc7af0
64 changed files with 1197 additions and 1082 deletions
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "image-iter.h"
|
#include "image-iter.h"
|
||||||
#include "color_util.h"
|
#include "color_util.h"
|
||||||
|
|
||||||
|
|
@ -105,8 +106,8 @@ fill_alpha_pattern(struct buffer *buf)
|
||||||
struct image_header ih = image_header_from(buf->image);
|
struct image_header ih = image_header_from(buf->image);
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
assert(ih.pixman_format == PIXMAN_a8r8g8b8);
|
test_assert_enum(ih.pixman_format, PIXMAN_a8r8g8b8);
|
||||||
assert(ih.width == BLOCK_WIDTH * ALPHA_STEPS);
|
test_assert_int_eq(ih.width, BLOCK_WIDTH * ALPHA_STEPS);
|
||||||
|
|
||||||
for (y = 0; y < ih.height; y++) {
|
for (y = 0; y < ih.height; y++) {
|
||||||
uint32_t *row = image_header_get_row_u32(&ih, y);
|
uint32_t *row = image_header_get_row_u32(&ih, y);
|
||||||
|
|
@ -193,8 +194,8 @@ get_middle_row(struct buffer *buf)
|
||||||
{
|
{
|
||||||
struct image_header ih = image_header_from(buf->image);
|
struct image_header ih = image_header_from(buf->image);
|
||||||
|
|
||||||
assert(ih.width >= BLOCK_WIDTH * ALPHA_STEPS);
|
test_assert_int_ge(ih.width, BLOCK_WIDTH * ALPHA_STEPS);
|
||||||
assert(ih.height >= BLOCK_WIDTH);
|
test_assert_int_ge(ih.height, BLOCK_WIDTH);
|
||||||
|
|
||||||
return image_header_get_row_u32(&ih, (BLOCK_WIDTH - 1) / 2);
|
return image_header_get_row_u32(&ih, (BLOCK_WIDTH - 1) / 2);
|
||||||
}
|
}
|
||||||
|
|
@ -351,10 +352,10 @@ TEST(alpha_blend)
|
||||||
move_client(client, 0, 0);
|
move_client(client, 0, 0);
|
||||||
|
|
||||||
shot = capture_screenshot_of_output(client, NULL);
|
shot = capture_screenshot_of_output(client, NULL);
|
||||||
assert(shot);
|
test_assert_ptr_not_null(shot);
|
||||||
match = verify_image(shot->image, "alpha_blend", seq_no, NULL, seq_no);
|
match = verify_image(shot->image, "alpha_blend", seq_no, NULL, seq_no);
|
||||||
assert(check_blend_pattern(bg, fg, shot, space));
|
test_assert_true(check_blend_pattern(bg, fg, shot, space));
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
buffer_destroy(shot);
|
buffer_destroy(shot);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,13 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define custom_assert_fail_ test_assert_report
|
|
||||||
|
|
||||||
#include "shared/weston-assert.h"
|
#include "shared/weston-assert.h"
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
|
|
||||||
__attribute__((format(printf, 2, 3)))
|
__attribute__((format(printf, 2, 3)))
|
||||||
static void
|
static inline void
|
||||||
test_assert_report(const struct weston_compositor *compositor, const char *fmt, ...)
|
test_assert_report(const struct weston_compositor *compositor,
|
||||||
|
const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
|
@ -44,6 +43,11 @@ test_assert_report(const struct weston_compositor *compositor, const char *fmt,
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef custom_assert_fail_
|
||||||
|
#undef custom_assert_fail_
|
||||||
|
#endif
|
||||||
|
#define custom_assert_fail_ test_assert_report
|
||||||
|
|
||||||
static void
|
static void
|
||||||
abort_if_not(bool cond)
|
abort_if_not(bool cond)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include "shared/os-compatibility.h"
|
#include "shared/os-compatibility.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -151,7 +152,7 @@ create_bad_shm_buffer(struct client *client, int width, int height)
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
fd = create_anonymous_file_without_seals(size);
|
fd = create_anonymous_file_without_seals(size);
|
||||||
assert(fd >= 0);
|
test_assert_int_ge(fd, 0);
|
||||||
|
|
||||||
pool = wl_shm_create_pool(shm, fd, size);
|
pool = wl_shm_create_pool(shm, fd, size);
|
||||||
buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride,
|
buffer = wl_shm_pool_create_buffer(pool, 0, width, height, stride,
|
||||||
|
|
@ -161,7 +162,7 @@ create_bad_shm_buffer(struct client *client, int width, int height)
|
||||||
/* Truncate the file to a small size, so that the compositor
|
/* Truncate the file to a small size, so that the compositor
|
||||||
* will access it out-of-bounds, and hit SIGBUS.
|
* will access it out-of-bounds, and hit SIGBUS.
|
||||||
*/
|
*/
|
||||||
assert(ftruncate(fd, 12) == 0);
|
test_assert_int_eq(ftruncate(fd, 12), 0);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
@ -176,7 +177,7 @@ TEST(test_truncated_shm_file)
|
||||||
int frame;
|
int frame;
|
||||||
|
|
||||||
client = create_client_and_test_surface(46, 76, 111, 134);
|
client = create_client_and_test_surface(46, 76, 111, 134);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
surface = client->surface->wl_surface;
|
surface = client->surface->wl_surface;
|
||||||
|
|
||||||
bad_buffer = create_bad_shm_buffer(client, 200, 200);
|
bad_buffer = create_bad_shm_buffer(client, 200, 200);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
#define TRANSFORM(x) WL_OUTPUT_TRANSFORM_ ## x, #x
|
#define TRANSFORM(x) WL_OUTPUT_TRANSFORM_ ## x, #x
|
||||||
#define RENDERERS(s, t) \
|
#define RENDERERS(s, t) \
|
||||||
|
|
@ -122,7 +123,7 @@ TEST_P(buffer_transform, my_buffer_args)
|
||||||
ret = asprintf(&refname, "output_%d-%s_buffer_%d-%s",
|
ret = asprintf(&refname, "output_%d-%s_buffer_%d-%s",
|
||||||
oargs->scale, oargs->transform_name,
|
oargs->scale, oargs->transform_name,
|
||||||
bargs->scale, bargs->transform_name);
|
bargs->scale, bargs->transform_name);
|
||||||
assert(ret);
|
test_assert_int_gt(ret, 0);
|
||||||
|
|
||||||
testlog("%s: %s\n", get_test_name(), refname);
|
testlog("%s: %s\n", get_test_name(), refname);
|
||||||
|
|
||||||
|
|
@ -144,7 +145,7 @@ TEST_P(buffer_transform, my_buffer_args)
|
||||||
move_client(client, 19, 19);
|
move_client(client, 19, 19);
|
||||||
|
|
||||||
match = verify_screen_content(client, refname, 0, NULL, 0, NULL);
|
match = verify_screen_content(client, refname, 0, NULL, 0, NULL);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
free(refname);
|
free(refname);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include <lcms2.h>
|
#include <lcms2.h>
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "image-iter.h"
|
#include "image-iter.h"
|
||||||
#include "lcms_util.h"
|
#include "lcms_util.h"
|
||||||
|
|
||||||
|
|
@ -197,10 +198,10 @@ build_output_icc_profile(const struct setup_args *arg, const char *filename)
|
||||||
bool saved;
|
bool saved;
|
||||||
|
|
||||||
profile = build_lcms_profile_output(arg);
|
profile = build_lcms_profile_output(arg);
|
||||||
assert(profile);
|
test_assert_ptr_not_null(profile);
|
||||||
|
|
||||||
saved = cmsSaveProfileToFile(profile, filename);
|
saved = cmsSaveProfileToFile(profile, filename);
|
||||||
assert(saved);
|
test_assert_true(saved);
|
||||||
|
|
||||||
cmsCloseProfile(profile);
|
cmsCloseProfile(profile);
|
||||||
}
|
}
|
||||||
|
|
@ -341,8 +342,8 @@ process_pipeline_comparison(const struct buffer *src_buf,
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
/* no point to compare different images */
|
/* no point to compare different images */
|
||||||
assert(ih_src.width == ih_shot.width);
|
test_assert_int_eq(ih_src.width, ih_shot.width);
|
||||||
assert(ih_src.height == ih_shot.height);
|
test_assert_int_eq(ih_src.height, ih_shot.height);
|
||||||
|
|
||||||
for (y = 0; y < ih_src.height; y++) {
|
for (y = 0; y < ih_src.height; y++) {
|
||||||
uint32_t *row_ptr = image_header_get_row_u32(&ih_src, y);
|
uint32_t *row_ptr = image_header_get_row_u32(&ih_src, y);
|
||||||
|
|
@ -406,7 +407,7 @@ TEST(opaque_pixel_conversion)
|
||||||
bool match;
|
bool match;
|
||||||
|
|
||||||
client = create_client_and_test_surface(0, 0, width, height);
|
client = create_client_and_test_surface(0, 0, width, height);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
surface = client->surface->wl_surface;
|
surface = client->surface->wl_surface;
|
||||||
|
|
||||||
buf = create_shm_buffer_a8r8g8b8(client, width, height);
|
buf = create_shm_buffer_a8r8g8b8(client, width, height);
|
||||||
|
|
@ -417,12 +418,12 @@ TEST(opaque_pixel_conversion)
|
||||||
wl_surface_commit(surface);
|
wl_surface_commit(surface);
|
||||||
|
|
||||||
shot = capture_screenshot_of_output(client, NULL);
|
shot = capture_screenshot_of_output(client, NULL);
|
||||||
assert(shot);
|
test_assert_ptr_not_null(shot);
|
||||||
|
|
||||||
match = verify_image(shot->image, "shaper_matrix", arg->ref_image_index,
|
match = verify_image(shot->image, "shaper_matrix", arg->ref_image_index,
|
||||||
NULL, seq_no);
|
NULL, seq_no);
|
||||||
assert(process_pipeline_comparison(buf, shot, arg));
|
test_assert_true(process_pipeline_comparison(buf, shot, arg));
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
buffer_destroy(shot);
|
buffer_destroy(shot);
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -451,7 +452,7 @@ compare_blend(const struct lcms_pipeline *pip,
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
/* convert sources to straight alpha */
|
/* convert sources to straight alpha */
|
||||||
assert(bg.a == 1.0f);
|
test_assert_f32_eq(bg.a, 1.0f);
|
||||||
fg = color_float_unpremult(fg);
|
fg = color_float_unpremult(fg);
|
||||||
|
|
||||||
bg = convert_to_blending_space(pip, bg);
|
bg = convert_to_blending_space(pip, bg);
|
||||||
|
|
@ -480,8 +481,8 @@ get_middle_row(struct buffer *buf)
|
||||||
{
|
{
|
||||||
struct image_header ih = image_header_from(buf->image);
|
struct image_header ih = image_header_from(buf->image);
|
||||||
|
|
||||||
assert(ih.width >= BLOCK_WIDTH * ALPHA_STEPS);
|
test_assert_int_ge(ih.width, BLOCK_WIDTH * ALPHA_STEPS);
|
||||||
assert(ih.height >= BLOCK_WIDTH);
|
test_assert_int_ge(ih.height, BLOCK_WIDTH);
|
||||||
|
|
||||||
return image_header_get_row_u32(&ih, (BLOCK_WIDTH - 1) / 2);
|
return image_header_get_row_u32(&ih, (BLOCK_WIDTH - 1) / 2);
|
||||||
}
|
}
|
||||||
|
|
@ -545,8 +546,8 @@ fill_alpha_pattern(struct buffer *buf)
|
||||||
struct image_header ih = image_header_from(buf->image);
|
struct image_header ih = image_header_from(buf->image);
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
assert(ih.pixman_format == PIXMAN_a8r8g8b8);
|
test_assert_enum(ih.pixman_format, PIXMAN_a8r8g8b8);
|
||||||
assert(ih.width == BLOCK_WIDTH * ALPHA_STEPS);
|
test_assert_int_eq(ih.width, BLOCK_WIDTH * ALPHA_STEPS);
|
||||||
|
|
||||||
for (y = 0; y < ih.height; y++) {
|
for (y = 0; y < ih.height; y++) {
|
||||||
uint32_t *row = image_header_get_row_u32(&ih, y);
|
uint32_t *row = image_header_get_row_u32(&ih, y);
|
||||||
|
|
@ -638,11 +639,11 @@ TEST(output_icc_alpha_blend)
|
||||||
move_client(client, 0, 0);
|
move_client(client, 0, 0);
|
||||||
|
|
||||||
shot = capture_screenshot_of_output(client, NULL);
|
shot = capture_screenshot_of_output(client, NULL);
|
||||||
assert(shot);
|
test_assert_ptr_not_null(shot);
|
||||||
match = verify_image(shot->image, "output_icc_alpha_blend", arg->ref_image_index,
|
match = verify_image(shot->image, "output_icc_alpha_blend", arg->ref_image_index,
|
||||||
NULL, seq_no);
|
NULL, seq_no);
|
||||||
assert(check_blend_pattern(bg, fg, shot, arg));
|
test_assert_true(check_blend_pattern(bg, fg, shot, arg));
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
buffer_destroy(shot);
|
buffer_destroy(shot);
|
||||||
|
|
||||||
|
|
@ -682,7 +683,7 @@ TEST(output_icc_decorations)
|
||||||
|
|
||||||
match = verify_image(img, "output-icc-decorations",
|
match = verify_image(img, "output-icc-decorations",
|
||||||
arg->ref_image_index, NULL, seq_no);
|
arg->ref_image_index, NULL, seq_no);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
pixman_image_unref(img);
|
pixman_image_unref(img);
|
||||||
buffer_destroy(shot);
|
buffer_destroy(shot);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include <lcms2_plugin.h>
|
#include <lcms2_plugin.h>
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "libweston/color-lcms/color-lcms.h"
|
#include "libweston/color-lcms/color-lcms.h"
|
||||||
#include "libweston/color-lcms/color-curve-segments.h"
|
#include "libweston/color-lcms/color-curve-segments.h"
|
||||||
|
|
||||||
|
|
@ -90,10 +91,10 @@ pipeline_context_new(void)
|
||||||
struct pipeline_context ret;
|
struct pipeline_context ret;
|
||||||
|
|
||||||
ret.context_id = cmsCreateContext(NULL, NULL);
|
ret.context_id = cmsCreateContext(NULL, NULL);
|
||||||
assert(ret.context_id);
|
test_assert_ptr_not_null(ret.context_id);
|
||||||
|
|
||||||
ret.pipeline = cmsPipelineAlloc(ret.context_id, N_CHANNELS, N_CHANNELS);
|
ret.pipeline = cmsPipelineAlloc(ret.context_id, N_CHANNELS, N_CHANNELS);
|
||||||
assert(ret.pipeline);
|
test_assert_ptr_not_null(ret.pipeline);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -115,15 +116,15 @@ add_curve(struct pipeline_context *pc, cmsInt32Number type,
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
curve = cmsBuildParametricToneCurve(pc->context_id, type, params);
|
curve = cmsBuildParametricToneCurve(pc->context_id, type, params);
|
||||||
assert(curve);
|
test_assert_ptr_not_null(curve);
|
||||||
|
|
||||||
for (i = 0; i < N_CHANNELS; i++)
|
for (i = 0; i < N_CHANNELS; i++)
|
||||||
curveset[i] = curve;
|
curveset[i] = curve;
|
||||||
|
|
||||||
stage = cmsStageAllocToneCurves(pc->context_id, ARRAY_LENGTH(curveset), curveset);
|
stage = cmsStageAllocToneCurves(pc->context_id, ARRAY_LENGTH(curveset), curveset);
|
||||||
assert(stage);
|
test_assert_ptr_not_null(stage);
|
||||||
|
|
||||||
assert(cmsPipelineInsertStage(pc->pipeline, cmsAT_END, stage));
|
test_assert_true(cmsPipelineInsertStage(pc->pipeline, cmsAT_END, stage));
|
||||||
|
|
||||||
cmsFreeToneCurve(curve);
|
cmsFreeToneCurve(curve);
|
||||||
}
|
}
|
||||||
|
|
@ -134,9 +135,9 @@ add_identity_curve(struct pipeline_context *pc)
|
||||||
cmsStage *stage;
|
cmsStage *stage;
|
||||||
|
|
||||||
stage = cmsStageAllocToneCurves(pc->context_id, N_CHANNELS, NULL);
|
stage = cmsStageAllocToneCurves(pc->context_id, N_CHANNELS, NULL);
|
||||||
assert(stage);
|
test_assert_ptr_not_null(stage);
|
||||||
|
|
||||||
assert(cmsPipelineInsertStage(pc->pipeline, cmsAT_END, stage));
|
test_assert_true(cmsPipelineInsertStage(pc->pipeline, cmsAT_END, stage));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -146,9 +147,9 @@ add_matrix(struct pipeline_context *pc,
|
||||||
cmsStage *stage;
|
cmsStage *stage;
|
||||||
|
|
||||||
stage = cmsStageAllocMatrix(pc->context_id, N_CHANNELS, N_CHANNELS, matrix, NULL);
|
stage = cmsStageAllocMatrix(pc->context_id, N_CHANNELS, N_CHANNELS, matrix, NULL);
|
||||||
assert(stage);
|
test_assert_ptr_not_null(stage);
|
||||||
|
|
||||||
assert(cmsPipelineInsertStage(pc->pipeline, cmsAT_END, stage));
|
test_assert_true(cmsPipelineInsertStage(pc->pipeline, cmsAT_END, stage));
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -176,11 +177,11 @@ TEST(keep_regular_matrix)
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
elem = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
elem = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
||||||
assert(elem);
|
test_assert_ptr_not_null(elem);
|
||||||
data = cmsStageData(elem);
|
data = cmsStageData(elem);
|
||||||
assert(are_matrices_equal(regular_matrix, data->Double));
|
test_assert_true(are_matrices_equal(regular_matrix, data->Double));
|
||||||
|
|
||||||
assert(!cmsStageNext(elem));
|
test_assert_ptr_null(cmsStageNext(elem));
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -194,7 +195,7 @@ TEST(drop_identity_matrix)
|
||||||
|
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
assert(cmsPipelineStageCount(pc.pipeline) == 0);
|
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -210,7 +211,7 @@ TEST(drop_inverse_matrices)
|
||||||
|
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
assert(cmsPipelineStageCount(pc.pipeline) == 0);
|
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -227,7 +228,7 @@ TEST(drop_identity_and_inverse_matrices)
|
||||||
|
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
assert(cmsPipelineStageCount(pc.pipeline) == 0);
|
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -247,11 +248,11 @@ TEST(only_drop_inverse_matrices)
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
elem = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
elem = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
||||||
assert(elem);
|
test_assert_ptr_not_null(elem);
|
||||||
data = cmsStageData(elem);
|
data = cmsStageData(elem);
|
||||||
assert(are_matrices_equal(regular_matrix, data->Double));
|
test_assert_true(are_matrices_equal(regular_matrix, data->Double));
|
||||||
|
|
||||||
assert(!cmsStageNext(elem));
|
test_assert_ptr_null(cmsStageNext(elem));
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -270,11 +271,11 @@ TEST(only_drop_inverse_matrices_another_order)
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
elem = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
elem = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
||||||
assert(elem);
|
test_assert_ptr_not_null(elem);
|
||||||
data = cmsStageData(elem);
|
data = cmsStageData(elem);
|
||||||
assert(are_matrices_equal(regular_matrix, data->Double));
|
test_assert_true(are_matrices_equal(regular_matrix, data->Double));
|
||||||
|
|
||||||
assert(!cmsStageNext(elem));
|
test_assert_ptr_null(cmsStageNext(elem));
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -288,7 +289,7 @@ TEST(drop_identity_curve)
|
||||||
|
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
assert(cmsPipelineStageCount(pc.pipeline) == 0);
|
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -304,7 +305,7 @@ TEST(drop_inverse_curves)
|
||||||
|
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
assert(cmsPipelineStageCount(pc.pipeline) == 0);
|
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -321,7 +322,7 @@ TEST(drop_identity_and_inverse_curves)
|
||||||
|
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
assert(cmsPipelineStageCount(pc.pipeline) == 0);
|
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -337,7 +338,7 @@ TEST(drop_identity_and_inverse_curves_another_order)
|
||||||
|
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
assert(cmsPipelineStageCount(pc.pipeline) == 0);
|
test_assert_u32_eq(cmsPipelineStageCount(pc.pipeline), 0);
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -355,7 +356,7 @@ are_curveset_curves_equal_to_curve(struct pipeline_context *pc,
|
||||||
cmsBuildParametricToneCurve(pc->context_id, curve->type,
|
cmsBuildParametricToneCurve(pc->context_id, curve->type,
|
||||||
curve->params);
|
curve->params);
|
||||||
|
|
||||||
assert(curveset_data->nCurves == N_CHANNELS);
|
test_assert_u32_eq(curveset_data->nCurves, N_CHANNELS);
|
||||||
|
|
||||||
for (i = 0; i < N_CHANNELS; i++) {
|
for (i = 0; i < N_CHANNELS; i++) {
|
||||||
if (!are_curves_equal(curveset_data->TheCurves[i], cms_curve)) {
|
if (!are_curves_equal(curveset_data->TheCurves[i], cms_curve)) {
|
||||||
|
|
@ -380,11 +381,11 @@ TEST(keep_regular_curve)
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
stage = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
stage = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
||||||
assert(stage);
|
test_assert_ptr_not_null(stage);
|
||||||
assert(are_curveset_curves_equal_to_curve(&pc, cmsStageData(stage),
|
test_assert_true(are_curveset_curves_equal_to_curve(&pc, cmsStageData(stage),
|
||||||
&power_law_curve_A));
|
&power_law_curve_A));
|
||||||
|
|
||||||
assert(!cmsStageNext(stage));
|
test_assert_ptr_null(cmsStageNext(stage));
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -404,11 +405,11 @@ TEST(do_not_merge_identity_with_parametric)
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
stage = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
stage = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
||||||
assert(stage);
|
test_assert_ptr_not_null(stage);
|
||||||
assert(are_curveset_curves_equal_to_curve(&pc, cmsStageData(stage),
|
test_assert_true(are_curveset_curves_equal_to_curve(&pc, cmsStageData(stage),
|
||||||
&srgb_curve));
|
&srgb_curve));
|
||||||
|
|
||||||
assert(!cmsStageNext(stage));
|
test_assert_ptr_null(cmsStageNext(stage));
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -430,11 +431,11 @@ TEST(merge_power_law_curves_with_itself)
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
stage = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
stage = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
||||||
assert(stage);
|
test_assert_ptr_not_null(stage);
|
||||||
assert(are_curveset_curves_equal_to_curve(&pc, cmsStageData(stage),
|
test_assert_true(are_curveset_curves_equal_to_curve(&pc, cmsStageData(stage),
|
||||||
&result_curve));
|
&result_curve));
|
||||||
|
|
||||||
assert(!cmsStageNext(stage));
|
test_assert_ptr_null(cmsStageNext(stage));
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
@ -456,11 +457,11 @@ TEST(merge_power_law_curves_with_another)
|
||||||
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
lcms_optimize_pipeline(&pc.pipeline, pc.context_id);
|
||||||
|
|
||||||
stage = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
stage = cmsPipelineGetPtrToFirstStage(pc.pipeline);
|
||||||
assert(stage);
|
test_assert_ptr_not_null(stage);
|
||||||
assert(are_curveset_curves_equal_to_curve(&pc, cmsStageData(stage),
|
test_assert_true(are_curveset_curves_equal_to_curve(&pc, cmsStageData(stage),
|
||||||
&result_curve));
|
&result_curve));
|
||||||
|
|
||||||
assert(!cmsStageNext(stage));
|
test_assert_ptr_null(cmsStageNext(stage));
|
||||||
|
|
||||||
pipeline_context_release(&pc);
|
pipeline_context_release(&pc);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "shared/xalloc.h"
|
#include "shared/xalloc.h"
|
||||||
|
|
||||||
#include "color-management-v1-client-protocol.h"
|
#include "color-management-v1-client-protocol.h"
|
||||||
|
|
@ -595,41 +596,45 @@ color_manager_init(struct color_manager *cm, struct client *client)
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
/* Weston supports all color features. */
|
/* Weston supports all color features. */
|
||||||
assert(cm->supported_features == ((1 << WP_COLOR_MANAGER_V1_FEATURE_ICC_V2_V4) |
|
test_assert_u32_eq(cm->supported_features,
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_PARAMETRIC) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_ICC_V2_V4) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_PRIMARIES) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_PARAMETRIC) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_LUMINANCES) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_PRIMARIES) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_TF_POWER) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_LUMINANCES) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_MASTERING_DISPLAY_PRIMARIES) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_TF_POWER) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_EXTENDED_TARGET_VOLUME)));
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_MASTERING_DISPLAY_PRIMARIES) |
|
||||||
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_EXTENDED_TARGET_VOLUME));
|
||||||
|
|
||||||
/* Weston supports all rendering intents. */
|
/* Weston supports all rendering intents. */
|
||||||
assert(cm->supported_rendering_intents == ((1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL) |
|
test_assert_u32_eq(cm->supported_rendering_intents,
|
||||||
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE) |
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_SATURATION) |
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_ABSOLUTE) |
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_SATURATION) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE_BPC)));
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_ABSOLUTE) |
|
||||||
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE_BPC));
|
||||||
|
|
||||||
/* Weston supports all primaries. */
|
/* Weston supports all primaries. */
|
||||||
assert(cm->supported_color_primaries == ((1 << WP_COLOR_MANAGER_V1_PRIMARIES_SRGB) |
|
test_assert_u32_eq(cm->supported_color_primaries,
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_PAL_M) |
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_SRGB) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_PAL) |
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_PAL_M) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_NTSC) |
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_PAL) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_GENERIC_FILM) |
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_NTSC) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_BT2020) |
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_GENERIC_FILM) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_CIE1931_XYZ) |
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_BT2020) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_DCI_P3) |
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_CIE1931_XYZ) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_DISPLAY_P3) |
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_DCI_P3) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_ADOBE_RGB)));
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_DISPLAY_P3) |
|
||||||
|
(1 << WP_COLOR_MANAGER_V1_PRIMARIES_ADOBE_RGB));
|
||||||
|
|
||||||
/* Weston supports only a few transfer functions, and we make use of
|
/* Weston supports only a few transfer functions, and we make use of
|
||||||
* them in our tests. */
|
* them in our tests. */
|
||||||
assert(cm->supported_tf == ((1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22) |
|
test_assert_u32_eq(cm->supported_tf,
|
||||||
(1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA28) |
|
(1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA22) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB) |
|
(1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_GAMMA28) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ)));
|
(1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_SRGB) |
|
||||||
|
(1 << WP_COLOR_MANAGER_V1_TRANSFER_FUNCTION_ST2084_PQ));
|
||||||
|
|
||||||
assert(cm->done);
|
test_assert_true(cm->done);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -665,8 +670,8 @@ TEST_P(create_parametric_image_description, good_test_cases)
|
||||||
struct image_description *image_desc = NULL;
|
struct image_description *image_desc = NULL;
|
||||||
|
|
||||||
/* No good test case should have expected error. */
|
/* No good test case should have expected error. */
|
||||||
assert(args->error_point == ERROR_POINT_NONE);
|
test_assert_enum(args->error_point, ERROR_POINT_NONE);
|
||||||
assert(args->expected_error == NOT_SET);
|
test_assert_enum(args->expected_error, NOT_SET);
|
||||||
|
|
||||||
client = create_client();
|
client = create_client();
|
||||||
color_manager_init(&cm, client);
|
color_manager_init(&cm, client);
|
||||||
|
|
@ -716,8 +721,8 @@ TEST_P(create_parametric_image_description, good_test_cases)
|
||||||
image_desc_creator_param = NULL;
|
image_desc_creator_param = NULL;
|
||||||
|
|
||||||
while (image_desc->status == CM_IMAGE_DESC_NOT_CREATED)
|
while (image_desc->status == CM_IMAGE_DESC_NOT_CREATED)
|
||||||
assert(wl_display_dispatch(client->wl_display) >= 0);
|
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||||
assert(image_desc->status == CM_IMAGE_DESC_READY);
|
test_assert_enum(image_desc->status, CM_IMAGE_DESC_READY);
|
||||||
|
|
||||||
image_description_destroy(image_desc);
|
image_description_destroy(image_desc);
|
||||||
color_manager_fini(&cm);
|
color_manager_fini(&cm);
|
||||||
|
|
@ -830,13 +835,13 @@ TEST_P(fail_to_create_parametric_image_description, bad_test_cases)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (image_desc->status == CM_IMAGE_DESC_NOT_CREATED)
|
while (image_desc->status == CM_IMAGE_DESC_NOT_CREATED)
|
||||||
assert(wl_display_dispatch(client->wl_display) >= 0);
|
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||||
|
|
||||||
/* This TEST() is for bad params, so we shouldn't be able to
|
/* This TEST() is for bad params, so we shouldn't be able to
|
||||||
* successfully create an image description. */
|
* successfully create an image description. */
|
||||||
assert(args->error_point == ERROR_POINT_GRACEFUL_FAILURE);
|
test_assert_enum(args->error_point, ERROR_POINT_GRACEFUL_FAILURE);
|
||||||
assert(image_desc->status == CM_IMAGE_DESC_FAILED);
|
test_assert_enum(image_desc->status, CM_IMAGE_DESC_FAILED);
|
||||||
assert(image_desc->failure_reason == args->expected_error);
|
test_assert_enum(image_desc->failure_reason, args->expected_error);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (image_desc)
|
if (image_desc)
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "color-properties.h"
|
#include "color-properties.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "shared/xalloc.h"
|
#include "shared/xalloc.h"
|
||||||
#include "lcms_util.h"
|
#include "lcms_util.h"
|
||||||
|
|
||||||
|
|
@ -170,9 +171,7 @@ static void
|
||||||
image_descr_info_received(struct image_description_info *image_descr_info,
|
image_descr_info_received(struct image_description_info *image_descr_info,
|
||||||
enum image_descr_info_event ev)
|
enum image_descr_info_event ev)
|
||||||
{
|
{
|
||||||
/* TODO: replace this assert with weston_assert_uint32_mask_bit_is_clear
|
test_assert_bit_not_set(image_descr_info->events_received, 1 << ev);
|
||||||
* when we start using weston-assert in the test suite. */
|
|
||||||
assert(!((image_descr_info->events_received >> ev) & 1));
|
|
||||||
image_descr_info->events_received |= (1 << ev);
|
image_descr_info->events_received |= (1 << ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -444,7 +443,7 @@ image_descr_info_done(void *data,
|
||||||
|
|
||||||
testlog("Image description info %p done:\n", wp_image_description_info_v1);
|
testlog("Image description info %p done:\n", wp_image_description_info_v1);
|
||||||
|
|
||||||
assert(are_events_received_valid(image_descr_info));
|
test_assert_true(are_events_received_valid(image_descr_info));
|
||||||
|
|
||||||
/* ICC based image description */
|
/* ICC based image description */
|
||||||
if ((image_descr_info->events_received >> IMAGE_DESCR_INFO_EVENT_ICC_FD) & 1) {
|
if ((image_descr_info->events_received >> IMAGE_DESCR_INFO_EVENT_ICC_FD) & 1) {
|
||||||
|
|
@ -596,22 +595,24 @@ color_manager_init(struct color_manager *cm, struct client *client)
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
/* Weston supports all color features. */
|
/* Weston supports all color features. */
|
||||||
assert(cm->supported_features == ((1 << WP_COLOR_MANAGER_V1_FEATURE_ICC_V2_V4) |
|
test_assert_u32_eq(cm->supported_features,
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_PARAMETRIC) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_ICC_V2_V4) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_PRIMARIES) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_PARAMETRIC) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_TF_POWER) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_PRIMARIES) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_LUMINANCES) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_TF_POWER) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_MASTERING_DISPLAY_PRIMARIES) |
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_LUMINANCES) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_FEATURE_EXTENDED_TARGET_VOLUME)));
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_SET_MASTERING_DISPLAY_PRIMARIES) |
|
||||||
|
(1 << WP_COLOR_MANAGER_V1_FEATURE_EXTENDED_TARGET_VOLUME));
|
||||||
|
|
||||||
/* Weston supports all rendering intents. */
|
/* Weston supports all rendering intents. */
|
||||||
assert(cm->supported_rendering_intents == ((1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL) |
|
test_assert_u32_eq(cm->supported_rendering_intents,
|
||||||
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE) |
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_PERCEPTUAL) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_SATURATION) |
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_ABSOLUTE) |
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_SATURATION) |
|
||||||
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE_BPC)));
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_ABSOLUTE) |
|
||||||
|
(1 << WP_COLOR_MANAGER_V1_RENDER_INTENT_RELATIVE_BPC));
|
||||||
|
|
||||||
assert(cm->done);
|
test_assert_true(cm->done);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -670,9 +671,9 @@ create_icc_based_image_description(struct color_manager *cm,
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
icc_fd = open(icc_path, O_RDONLY);
|
icc_fd = open(icc_path, O_RDONLY);
|
||||||
assert(icc_fd >= 0);
|
test_assert_s32_ge(icc_fd, 0);
|
||||||
|
|
||||||
assert(fstat(icc_fd, &st) == 0);
|
test_assert_int_eq(fstat(icc_fd, &st), 0);
|
||||||
|
|
||||||
wp_image_description_creator_icc_v1_set_icc_file(image_descr_creator_icc,
|
wp_image_description_creator_icc_v1_set_icc_file(image_descr_creator_icc,
|
||||||
icc_fd, 0, st.st_size);
|
icc_fd, 0, st.st_size);
|
||||||
|
|
@ -698,10 +699,10 @@ build_sRGB_icc_profile(const char *filename)
|
||||||
|
|
||||||
profile = build_lcms_matrix_shaper_profile_output(NULL, &pipeline_sRGB,
|
profile = build_lcms_matrix_shaper_profile_output(NULL, &pipeline_sRGB,
|
||||||
vcgt_exponents);
|
vcgt_exponents);
|
||||||
assert(profile);
|
test_assert_ptr_not_null(profile);
|
||||||
|
|
||||||
saved = cmsSaveProfileToFile(profile, filename);
|
saved = cmsSaveProfileToFile(profile, filename);
|
||||||
assert(saved);
|
test_assert_true(saved);
|
||||||
|
|
||||||
cmsCloseProfile(profile);
|
cmsCloseProfile(profile);
|
||||||
}
|
}
|
||||||
|
|
@ -723,7 +724,7 @@ fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
||||||
tmp = output_filename_for_test_program(THIS_TEST_NAME,
|
tmp = output_filename_for_test_program(THIS_TEST_NAME,
|
||||||
NULL, "icm");
|
NULL, "icm");
|
||||||
assert(strlen(tmp) < ARRAY_LENGTH(srgb_icc_profile_path));
|
test_assert_int_lt(strlen(tmp), ARRAY_LENGTH(srgb_icc_profile_path));
|
||||||
strcpy(srgb_icc_profile_path, tmp);
|
strcpy(srgb_icc_profile_path, tmp);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
|
|
@ -781,9 +782,9 @@ wait_until_image_description_ready(struct client *client,
|
||||||
struct image_description *image_descr)
|
struct image_description *image_descr)
|
||||||
{
|
{
|
||||||
while (image_descr->status == CM_IMAGE_DESC_NOT_CREATED)
|
while (image_descr->status == CM_IMAGE_DESC_NOT_CREATED)
|
||||||
assert(wl_display_dispatch(client->wl_display) >= 0);
|
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||||
|
|
||||||
assert(image_descr->status == CM_IMAGE_DESC_READY);
|
test_assert_enum(image_descr->status, CM_IMAGE_DESC_READY);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(output_get_image_description)
|
TEST(output_get_image_description)
|
||||||
|
|
@ -877,8 +878,8 @@ TEST(set_unreadable_icc_fd)
|
||||||
/* The file is being open with WRITE, not READ permission. So the
|
/* The file is being open with WRITE, not READ permission. So the
|
||||||
* compositor should complain. */
|
* compositor should complain. */
|
||||||
icc_fd = open(srgb_icc_profile_path, O_WRONLY);
|
icc_fd = open(srgb_icc_profile_path, O_WRONLY);
|
||||||
assert(icc_fd >= 0);
|
test_assert_s32_ge(icc_fd, 0);
|
||||||
assert(fstat(icc_fd, &st) == 0);
|
test_assert_int_eq(fstat(icc_fd, &st), 0);
|
||||||
|
|
||||||
/* Try setting the bad ICC file fd, it should fail. */
|
/* Try setting the bad ICC file fd, it should fail. */
|
||||||
wp_image_description_creator_icc_v1_set_icc_file(image_descr_creator_icc,
|
wp_image_description_creator_icc_v1_set_icc_file(image_descr_creator_icc,
|
||||||
|
|
@ -906,7 +907,7 @@ TEST(set_bad_icc_size_zero)
|
||||||
wp_color_manager_v1_create_icc_creator(cm.manager);
|
wp_color_manager_v1_create_icc_creator(cm.manager);
|
||||||
|
|
||||||
icc_fd = open(srgb_icc_profile_path, O_RDONLY);
|
icc_fd = open(srgb_icc_profile_path, O_RDONLY);
|
||||||
assert(icc_fd >= 0);
|
test_assert_s32_ge(icc_fd, 0);
|
||||||
|
|
||||||
/* Try setting ICC file with a bad size, it should fail. */
|
/* Try setting ICC file with a bad size, it should fail. */
|
||||||
wp_image_description_creator_icc_v1_set_icc_file(image_descr_creator_icc,
|
wp_image_description_creator_icc_v1_set_icc_file(image_descr_creator_icc,
|
||||||
|
|
@ -934,7 +935,7 @@ TEST(set_bad_icc_non_seekable)
|
||||||
wp_color_manager_v1_create_icc_creator(cm.manager);
|
wp_color_manager_v1_create_icc_creator(cm.manager);
|
||||||
|
|
||||||
/* We need a non-seekable file, and pipes are non-seekable. */
|
/* We need a non-seekable file, and pipes are non-seekable. */
|
||||||
assert(pipe(fds) >= 0);
|
test_assert_int_ge(pipe(fds), 0);
|
||||||
|
|
||||||
/* Pretend that it has a valid size of 1024 bytes. That still should
|
/* Pretend that it has a valid size of 1024 bytes. That still should
|
||||||
* fail because the fd is non-seekable. */
|
* fail because the fd is non-seekable. */
|
||||||
|
|
@ -965,8 +966,8 @@ TEST(set_icc_twice)
|
||||||
wp_color_manager_v1_create_icc_creator(cm.manager);
|
wp_color_manager_v1_create_icc_creator(cm.manager);
|
||||||
|
|
||||||
icc_fd = open(srgb_icc_profile_path, O_RDONLY);
|
icc_fd = open(srgb_icc_profile_path, O_RDONLY);
|
||||||
assert(icc_fd >= 0);
|
test_assert_s32_ge(icc_fd, 0);
|
||||||
assert(fstat(icc_fd, &st) == 0);
|
test_assert_int_eq(fstat(icc_fd, &st), 0);
|
||||||
|
|
||||||
wp_image_description_creator_icc_v1_set_icc_file(image_descr_creator_icc,
|
wp_image_description_creator_icc_v1_set_icc_file(image_descr_creator_icc,
|
||||||
icc_fd, 0, st.st_size);
|
icc_fd, 0, st.st_size);
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,11 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
#include "weston-private.h"
|
#include "weston-private.h"
|
||||||
#include "libweston-internal.h"
|
#include "libweston-internal.h"
|
||||||
|
|
@ -225,17 +225,17 @@ TEST_P(color_characteristics_config_error, config_cases)
|
||||||
|
|
||||||
wc = create_config(t);
|
wc = create_config(t);
|
||||||
section = weston_config_get_section(wc, "output", "name", "mockoutput");
|
section = weston_config_get_section(wc, "output", "name", "mockoutput");
|
||||||
assert(section);
|
test_assert_ptr_not_null(section);
|
||||||
|
|
||||||
retval = wet_output_set_color_characteristics(&mock_output, wc, section);
|
retval = wet_output_set_color_characteristics(&mock_output, wc, section);
|
||||||
|
|
||||||
assert(fclose(logfile) == 0);
|
test_assert_int_eq(fclose(logfile), 0);
|
||||||
logfile = NULL;
|
logfile = NULL;
|
||||||
|
|
||||||
testlog("retval %d, logs:\n%s\n", retval, logbuf);
|
testlog("retval %d, logs:\n%s\n", retval, logbuf);
|
||||||
|
|
||||||
assert(retval == t->expected_retval);
|
test_assert_int_eq(retval, t->expected_retval);
|
||||||
assert(strcmp(logbuf, t->expected_error) == 0);
|
test_assert_int_eq(strcmp(logbuf, t->expected_error), 0);
|
||||||
|
|
||||||
weston_config_destroy(wc);
|
weston_config_destroy(wc);
|
||||||
free(logbuf);
|
free(logbuf);
|
||||||
|
|
@ -264,7 +264,7 @@ TEST(weston_output_set_color_characteristics_null)
|
||||||
|
|
||||||
mock_output.color_characteristics.group_mask = 1;
|
mock_output.color_characteristics.group_mask = 1;
|
||||||
weston_output_set_color_characteristics(&mock_output, NULL);
|
weston_output_set_color_characteristics(&mock_output, NULL);
|
||||||
assert(mock_output.color_characteristics.group_mask == 0);
|
test_assert_u32_eq(mock_output.color_characteristics.group_mask, 0);
|
||||||
|
|
||||||
weston_output_release(&mock_output);
|
weston_output_release(&mock_output);
|
||||||
weston_idalloc_destroy(mock_compositor.color_profile_id_generator);
|
weston_idalloc_destroy(mock_compositor.color_profile_id_generator);
|
||||||
|
|
@ -347,10 +347,10 @@ TEST_P(hdr_metadata_type1_errors, value_cases)
|
||||||
wl_list_init(&mock_compositor.plane_list);
|
wl_list_init(&mock_compositor.plane_list);
|
||||||
weston_output_init(&mock_output, &mock_compositor, "mockoutput");
|
weston_output_init(&mock_output, &mock_compositor, "mockoutput");
|
||||||
|
|
||||||
assert(t->field_index < ARRAY_LENGTH(fields));
|
test_assert_uint_lt(t->field_index, ARRAY_LENGTH(fields));
|
||||||
*fields[t->field_index] = t->value;
|
*fields[t->field_index] = t->value;
|
||||||
ret = weston_output_set_color_outcome(&mock_output);
|
ret = weston_output_set_color_outcome(&mock_output);
|
||||||
assert(ret == t->retval);
|
test_assert_int_eq(ret, t->retval);
|
||||||
|
|
||||||
weston_output_color_outcome_destroy(&mock_output.color_outcome);
|
weston_output_color_outcome_destroy(&mock_output.color_outcome);
|
||||||
weston_output_release(&mock_output);
|
weston_output_release(&mock_output);
|
||||||
|
|
@ -393,7 +393,7 @@ TEST(hdr_metadata_type1_ignore_unflagged)
|
||||||
weston_output_init(&mock_output, &mock_compositor, "mockoutput");
|
weston_output_init(&mock_output, &mock_compositor, "mockoutput");
|
||||||
|
|
||||||
ret = weston_output_set_color_outcome(&mock_output);
|
ret = weston_output_set_color_outcome(&mock_output);
|
||||||
assert(ret);
|
test_assert_true(ret);
|
||||||
|
|
||||||
weston_output_color_outcome_destroy(&mock_output.color_outcome);
|
weston_output_color_outcome_destroy(&mock_output.color_outcome);
|
||||||
weston_output_release(&mock_output);
|
weston_output_release(&mock_output);
|
||||||
|
|
@ -633,14 +633,14 @@ TEST_P(mode_config_error, mode_config_cases)
|
||||||
weston_head_set_supported_eotf_mask(&mock_head, t->supported_eotf_mask);
|
weston_head_set_supported_eotf_mask(&mock_head, t->supported_eotf_mask);
|
||||||
weston_head_set_supported_colorimetry_mask(&mock_head, t->supported_colorimetry_mask);
|
weston_head_set_supported_colorimetry_mask(&mock_head, t->supported_colorimetry_mask);
|
||||||
attached = weston_output_attach_head(&mock_output, &mock_head);
|
attached = weston_output_attach_head(&mock_output, &mock_head);
|
||||||
assert(attached == 0);
|
test_assert_int_eq(attached, 0);
|
||||||
|
|
||||||
logfile = open_memstream(&logbuf, &logsize);
|
logfile = open_memstream(&logbuf, &logsize);
|
||||||
weston_log_set_handler(logger, logger);
|
weston_log_set_handler(logger, logger);
|
||||||
|
|
||||||
wc = create_mode_config(t);
|
wc = create_mode_config(t);
|
||||||
section = weston_config_get_section(wc, "output", "name", "mockoutput");
|
section = weston_config_get_section(wc, "output", "name", "mockoutput");
|
||||||
assert(section);
|
test_assert_ptr_not_null(section);
|
||||||
|
|
||||||
retval = wet_output_set_eotf_mode(&mock_output, section, t->color_management);
|
retval = wet_output_set_eotf_mode(&mock_output, section, t->color_management);
|
||||||
if (retval == 0) {
|
if (retval == 0) {
|
||||||
|
|
@ -648,15 +648,15 @@ TEST_P(mode_config_error, mode_config_cases)
|
||||||
t->color_management);
|
t->color_management);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(fclose(logfile) == 0);
|
test_assert_int_eq(fclose(logfile), 0);
|
||||||
logfile = NULL;
|
logfile = NULL;
|
||||||
|
|
||||||
testlog("retval %d, logs:\n%s\n", retval, logbuf);
|
testlog("retval %d, logs:\n%s\n", retval, logbuf);
|
||||||
|
|
||||||
assert(retval == t->expected_retval);
|
test_assert_int_eq(retval, t->expected_retval);
|
||||||
assert(strcmp(logbuf, t->expected_error) == 0);
|
test_assert_int_eq(strcmp(logbuf, t->expected_error), 0);
|
||||||
assert(weston_output_get_eotf_mode(&mock_output) == t->expected_eotf_mode);
|
test_assert_enum(weston_output_get_eotf_mode(&mock_output), t->expected_eotf_mode);
|
||||||
assert(weston_output_get_colorimetry_mode(&mock_output) == t->expected_colorimetry_mode);
|
test_assert_enum(weston_output_get_colorimetry_mode(&mock_output), t->expected_colorimetry_mode);
|
||||||
|
|
||||||
weston_config_destroy(wc);
|
weston_config_destroy(wc);
|
||||||
free(logbuf);
|
free(logbuf);
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,10 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "backend.h"
|
#include "backend.h"
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
|
|
||||||
|
|
@ -86,41 +86,41 @@ PLUGIN_TEST(color_characteristics_from_weston_ini)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(output);
|
test_assert_ptr_not_null(output);
|
||||||
|
|
||||||
mode = weston_output_get_eotf_mode(output);
|
mode = weston_output_get_eotf_mode(output);
|
||||||
assert(mode == WESTON_EOTF_MODE_ST2084);
|
test_assert_enum(mode, WESTON_EOTF_MODE_ST2084);
|
||||||
|
|
||||||
colorimetry_mode = weston_output_get_colorimetry_mode(output);
|
colorimetry_mode = weston_output_get_colorimetry_mode(output);
|
||||||
assert(colorimetry_mode == WESTON_COLORIMETRY_MODE_BT2020_RGB);
|
test_assert_enum(colorimetry_mode, WESTON_COLORIMETRY_MODE_BT2020_RGB);
|
||||||
|
|
||||||
cc = weston_output_get_color_characteristics(output);
|
cc = weston_output_get_color_characteristics(output);
|
||||||
assert(cc->group_mask == WESTON_COLOR_CHARACTERISTICS_GROUP_ALL_MASK);
|
test_assert_enum(cc->group_mask, WESTON_COLOR_CHARACTERISTICS_GROUP_ALL_MASK);
|
||||||
assert(cc->primary[0].x == 0.9999f);
|
test_assert_f32_eq(cc->primary[0].x, 0.9999f);
|
||||||
assert(cc->primary[0].y == 0.3f);
|
test_assert_f32_eq(cc->primary[0].y, 0.3f);
|
||||||
assert(cc->primary[1].x == 0.1771f);
|
test_assert_f32_eq(cc->primary[1].x, 0.1771f);
|
||||||
assert(cc->primary[1].y == 0.80001f);
|
test_assert_f32_eq(cc->primary[1].y, 0.80001f);
|
||||||
assert(cc->primary[2].x == 0.1f);
|
test_assert_f32_eq(cc->primary[2].x, 0.1f);
|
||||||
assert(cc->primary[2].y == 0.11f);
|
test_assert_f32_eq(cc->primary[2].y, 0.11f);
|
||||||
assert(cc->white.x == 0.313f);
|
test_assert_f32_eq(cc->white.x, 0.313f);
|
||||||
assert(cc->white.y == 0.323f);
|
test_assert_f32_eq(cc->white.y, 0.323f);
|
||||||
assert(cc->min_luminance == 0.0001f);
|
test_assert_f32_eq(cc->min_luminance, 0.0001f);
|
||||||
assert(cc->max_luminance == 65535.0f);
|
test_assert_f32_eq(cc->max_luminance, 65535.0f);
|
||||||
assert(cc->maxFALL == 1000.0f);
|
test_assert_f32_eq(cc->maxFALL, 1000.0f);
|
||||||
|
|
||||||
/* The below is color manager policy. */
|
/* The below is color manager policy. */
|
||||||
hdr_meta = weston_output_get_hdr_metadata_type1(output);
|
hdr_meta = weston_output_get_hdr_metadata_type1(output);
|
||||||
assert(hdr_meta->group_mask == WESTON_HDR_METADATA_TYPE1_GROUP_ALL_MASK);
|
test_assert_enum(hdr_meta->group_mask, WESTON_HDR_METADATA_TYPE1_GROUP_ALL_MASK);
|
||||||
assert(hdr_meta->primary[0].x == 0.9999f);
|
test_assert_f32_eq(hdr_meta->primary[0].x, 0.9999f);
|
||||||
assert(hdr_meta->primary[0].y == 0.3f);
|
test_assert_f32_eq(hdr_meta->primary[0].y, 0.3f);
|
||||||
assert(hdr_meta->primary[1].x == 0.1771f);
|
test_assert_f32_eq(hdr_meta->primary[1].x, 0.1771f);
|
||||||
assert(hdr_meta->primary[1].y == 0.80001f);
|
test_assert_f32_eq(hdr_meta->primary[1].y, 0.80001f);
|
||||||
assert(hdr_meta->primary[2].x == 0.1f);
|
test_assert_f32_eq(hdr_meta->primary[2].x, 0.1f);
|
||||||
assert(hdr_meta->primary[2].y == 0.11f);
|
test_assert_f32_eq(hdr_meta->primary[2].y, 0.11f);
|
||||||
assert(hdr_meta->white.x == 0.313f);
|
test_assert_f32_eq(hdr_meta->white.x, 0.313f);
|
||||||
assert(hdr_meta->white.y == 0.323f);
|
test_assert_f32_eq(hdr_meta->white.y, 0.323f);
|
||||||
assert(hdr_meta->minDML == 0.0001f);
|
test_assert_f32_eq(hdr_meta->minDML, 0.0001f);
|
||||||
assert(hdr_meta->maxDML == 65535.0f);
|
test_assert_f32_eq(hdr_meta->maxDML, 65535.0f);
|
||||||
assert(hdr_meta->maxCLL == 65535.0f);
|
test_assert_f32_eq(hdr_meta->maxCLL, 65535.0f);
|
||||||
assert(hdr_meta->maxFALL == 1000.0f);
|
test_assert_f32_eq(hdr_meta->maxFALL, 1000.0f);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include <libweston/matrix.h>
|
#include <libweston/matrix.h>
|
||||||
#include "color_util.h"
|
#include "color_util.h"
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "shared/helpers.h"
|
#include "shared/helpers.h"
|
||||||
|
|
||||||
static_assert(sizeof(struct color_float) == 4 * sizeof(float),
|
static_assert(sizeof(struct color_float) == 4 * sizeof(float),
|
||||||
|
|
@ -117,7 +118,7 @@ transfer_fn_invert(enum transfer_fn fn)
|
||||||
case TRANSFER_FN_SRGB_EOTF_INVERSE:
|
case TRANSFER_FN_SRGB_EOTF_INVERSE:
|
||||||
return TRANSFER_FN_SRGB_EOTF;
|
return TRANSFER_FN_SRGB_EOTF;
|
||||||
}
|
}
|
||||||
assert(0 && "bad transfer_fn");
|
test_assert_not_reached("bad transfer_fn");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -140,7 +141,7 @@ transfer_fn_name(enum transfer_fn fn)
|
||||||
case TRANSFER_FN_SRGB_EOTF_INVERSE:
|
case TRANSFER_FN_SRGB_EOTF_INVERSE:
|
||||||
return "inverse sRGB EOTF";
|
return "inverse sRGB EOTF";
|
||||||
}
|
}
|
||||||
assert(0 && "bad transfer_fn");
|
test_assert_not_reached("bad transfer_fn");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -155,10 +156,10 @@ ensure_unit_range(float v)
|
||||||
const float lim_lo = -tol;
|
const float lim_lo = -tol;
|
||||||
const float lim_hi = 1.0f + tol;
|
const float lim_hi = 1.0f + tol;
|
||||||
|
|
||||||
assert(v >= lim_lo);
|
test_assert_f32_ge(v, lim_lo);
|
||||||
if (v < 0.0f)
|
if (v < 0.0f)
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
assert(v <= lim_hi);
|
test_assert_f32_le(v, lim_hi);
|
||||||
if (v > 1.0f)
|
if (v > 1.0f)
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
return v;
|
return v;
|
||||||
|
|
@ -389,7 +390,7 @@ lcmsMAT3_invert(struct lcmsMAT3 *result, const struct lcmsMAT3 *mat)
|
||||||
|
|
||||||
weston_matrix_from_lcmsMAT3(&w, mat);
|
weston_matrix_from_lcmsMAT3(&w, mat);
|
||||||
ret = weston_matrix_invert(&inv, &w);
|
ret = weston_matrix_invert(&inv, &w);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
lcmsMAT3_from_weston_matrix(result, &inv);
|
lcmsMAT3_from_weston_matrix(result, &inv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -489,7 +490,7 @@ rgb_diff_stat_print(const struct rgb_diff_stat *stat,
|
||||||
float scale = exp2f(scaling_bits) - 1.0f;
|
float scale = exp2f(scaling_bits) - 1.0f;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
assert(scaling_bits > 0);
|
test_assert_uint_gt(scaling_bits, 0);
|
||||||
|
|
||||||
testlog("%s error statistics, %u samples, value range 0.0 - %.1f:\n",
|
testlog("%s error statistics, %u samples, value range 0.0 - %.1f:\n",
|
||||||
title, stat->two_norm.count, scale);
|
title, stat->two_norm.count, scale);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "shared/timespec-util.h"
|
#include "shared/timespec-util.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-client-protocol.h"
|
#include "weston-test-client-protocol.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
struct constraints {
|
struct constraints {
|
||||||
struct zwp_pointer_constraints_v1 *zwp_pointer_constraints;
|
struct zwp_pointer_constraints_v1 *zwp_pointer_constraints;
|
||||||
|
|
@ -76,7 +77,7 @@ pointer_locked_event(void *data, struct zwp_locked_pointer_v1 *locked_pointer)
|
||||||
{
|
{
|
||||||
struct constraints *cs = data;
|
struct constraints *cs = data;
|
||||||
|
|
||||||
assert(locked_pointer == cs->zwp_locked_pointer);
|
test_assert_ptr_eq(locked_pointer, cs->zwp_locked_pointer);
|
||||||
cs->pointer_is_locked = true;
|
cs->pointer_is_locked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,7 +86,7 @@ pointer_unlocked_event(void *data, struct zwp_locked_pointer_v1 *locked_pointer)
|
||||||
{
|
{
|
||||||
struct constraints *cs = data;
|
struct constraints *cs = data;
|
||||||
|
|
||||||
assert(locked_pointer == cs->zwp_locked_pointer);
|
test_assert_ptr_eq(locked_pointer, cs->zwp_locked_pointer);
|
||||||
cs->pointer_is_locked = false;
|
cs->pointer_is_locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,7 +100,7 @@ pointer_confined_event(void *data, struct zwp_confined_pointer_v1 *confined_poin
|
||||||
{
|
{
|
||||||
struct constraints *cs = data;
|
struct constraints *cs = data;
|
||||||
|
|
||||||
assert(confined_pointer == cs->zwp_confined_pointer);
|
test_assert_ptr_eq(confined_pointer, cs->zwp_confined_pointer);
|
||||||
cs->pointer_is_confined = true;
|
cs->pointer_is_confined = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +109,7 @@ pointer_unconfined_event(void *data, struct zwp_confined_pointer_v1 *confined_po
|
||||||
{
|
{
|
||||||
struct constraints *cs = data;
|
struct constraints *cs = data;
|
||||||
|
|
||||||
assert(confined_pointer == cs->zwp_confined_pointer);
|
test_assert_ptr_eq(confined_pointer, cs->zwp_confined_pointer);
|
||||||
cs->pointer_is_confined = false;
|
cs->pointer_is_confined = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -173,7 +174,7 @@ constraints_init(struct constraints *cs, struct client *client)
|
||||||
cs->zwp_pointer_constraints = bind_to_singleton_global(client,
|
cs->zwp_pointer_constraints = bind_to_singleton_global(client,
|
||||||
&zwp_pointer_constraints_v1_interface,
|
&zwp_pointer_constraints_v1_interface,
|
||||||
1);
|
1);
|
||||||
assert(cs->zwp_pointer_constraints);
|
test_assert_ptr_not_null(cs->zwp_pointer_constraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -208,25 +209,25 @@ TEST(constraints_events)
|
||||||
/* receive confined events for oneshot lifetime */
|
/* receive confined events for oneshot lifetime */
|
||||||
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
||||||
assert(cs.pointer_is_confined);
|
test_assert_true(cs.pointer_is_confined);
|
||||||
confine_destroy(&cs, client);
|
confine_destroy(&cs, client);
|
||||||
|
|
||||||
/* receive confined events for persistent lifetime */
|
/* receive confined events for persistent lifetime */
|
||||||
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
|
||||||
assert(cs.pointer_is_confined);
|
test_assert_true(cs.pointer_is_confined);
|
||||||
confine_destroy(&cs, client);
|
confine_destroy(&cs, client);
|
||||||
|
|
||||||
/* receive locked events for oneshot lifetime */
|
/* receive locked events for oneshot lifetime */
|
||||||
lock_pointer(&cs, client, &locked_pointer_listener, NULL,
|
lock_pointer(&cs, client, &locked_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
||||||
assert(cs.pointer_is_locked);
|
test_assert_true(cs.pointer_is_locked);
|
||||||
lock_destroy(&cs, client);
|
lock_destroy(&cs, client);
|
||||||
|
|
||||||
/* receive locked events for persistent lifetime */
|
/* receive locked events for persistent lifetime */
|
||||||
lock_pointer(&cs, client, &locked_pointer_listener, NULL,
|
lock_pointer(&cs, client, &locked_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
|
||||||
assert(cs.pointer_is_locked);
|
test_assert_true(cs.pointer_is_locked);
|
||||||
lock_destroy(&cs, client);
|
lock_destroy(&cs, client);
|
||||||
|
|
||||||
constraint_deinit(&cs);
|
constraint_deinit(&cs);
|
||||||
|
|
@ -248,40 +249,40 @@ TEST(constraints_confined_boundaries_input_region)
|
||||||
/* confine to whole surface */
|
/* confine to whole surface */
|
||||||
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
||||||
assert(cs.pointer_is_confined);
|
test_assert_true(cs.pointer_is_confined);
|
||||||
|
|
||||||
/* move to boundary */
|
/* move to boundary */
|
||||||
move_pointer(client, 100, 100);
|
move_pointer(client, 100, 100);
|
||||||
|
|
||||||
/* x-1 (outside boundary) */
|
/* x-1 (outside boundary) */
|
||||||
move_pointer(client, client->surface->x-1, client->surface->y);
|
move_pointer(client, client->surface->x-1, client->surface->y);
|
||||||
assert(client->input->pointer->focus == client->surface);
|
test_assert_ptr_eq(client->input->pointer->focus, client->surface);
|
||||||
assert(client->test->pointer_x == client->surface->x);
|
test_assert_int_eq(client->test->pointer_x, client->surface->x);
|
||||||
|
|
||||||
/* y-1 (outside boundary) */
|
/* y-1 (outside boundary) */
|
||||||
move_pointer(client, client->surface->x, client->surface->y-1);
|
move_pointer(client, client->surface->x, client->surface->y-1);
|
||||||
assert(client->input->pointer->focus == client->surface);
|
test_assert_ptr_eq(client->input->pointer->focus, client->surface);
|
||||||
assert(client->test->pointer_y == client->surface->y);
|
test_assert_int_eq(client->test->pointer_y, client->surface->y);
|
||||||
|
|
||||||
/* x+width (outside boundary) */
|
/* x+width (outside boundary) */
|
||||||
move_pointer(client, client->surface->x+client->surface->width,
|
move_pointer(client, client->surface->x+client->surface->width,
|
||||||
client->surface->y);
|
client->surface->y);
|
||||||
assert(client->input->pointer->focus == client->surface);
|
test_assert_ptr_eq(client->input->pointer->focus, client->surface);
|
||||||
assert(client->test->pointer_x ==
|
test_assert_int_eq(client->test->pointer_x,
|
||||||
client->surface->x+client->surface->width-1);
|
client->surface->x+client->surface->width-1);
|
||||||
|
|
||||||
/* y+height (outside boundary) */
|
/* y+height (outside boundary) */
|
||||||
move_pointer(client, client->surface->x,
|
move_pointer(client, client->surface->x,
|
||||||
client->surface->y+client->surface->height);
|
client->surface->y+client->surface->height);
|
||||||
assert(client->input->pointer->focus == client->surface);
|
test_assert_ptr_eq(client->input->pointer->focus, client->surface);
|
||||||
assert(client->test->pointer_y ==
|
test_assert_int_eq(client->test->pointer_y,
|
||||||
client->surface->y+client->surface->height-1);
|
client->surface->y+client->surface->height-1);
|
||||||
|
|
||||||
confine_destroy(&cs, client);
|
confine_destroy(&cs, client);
|
||||||
/* x-1 (after unconfinement) */
|
/* x-1 (after unconfinement) */
|
||||||
move_pointer(client, client->surface->x-1, client->surface->y);
|
move_pointer(client, client->surface->x-1, client->surface->y);
|
||||||
assert(client->input->pointer->focus != client->surface);
|
test_assert_ptr_ne(client->input->pointer->focus, client->surface);
|
||||||
assert(client->test->pointer_x == client->surface->x-1);
|
test_assert_int_eq(client->test->pointer_x, client->surface->x-1);
|
||||||
|
|
||||||
constraint_deinit(&cs);
|
constraint_deinit(&cs);
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -301,23 +302,23 @@ TEST(constraints_locked_boundaries_input_region)
|
||||||
|
|
||||||
lock_pointer(&cs, client, &locked_pointer_listener, NULL,
|
lock_pointer(&cs, client, &locked_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
||||||
assert(cs.pointer_is_locked);
|
test_assert_true(cs.pointer_is_locked);
|
||||||
|
|
||||||
/* x-1 (outside surface) */
|
/* x-1 (outside surface) */
|
||||||
move_pointer(client, client->surface->x-1, client->surface->y);
|
move_pointer(client, client->surface->x-1, client->surface->y);
|
||||||
assert(client->input->pointer->focus == client->surface);
|
test_assert_ptr_eq(client->input->pointer->focus, client->surface);
|
||||||
assert(client->test->pointer_x == client->surface->x);
|
test_assert_int_eq(client->test->pointer_x, client->surface->x);
|
||||||
|
|
||||||
/* x+1 (inside surface) */
|
/* x+1 (inside surface) */
|
||||||
move_pointer(client, client->surface->x+1, client->surface->y);
|
move_pointer(client, client->surface->x+1, client->surface->y);
|
||||||
assert(client->input->pointer->focus == client->surface);
|
test_assert_ptr_eq(client->input->pointer->focus, client->surface);
|
||||||
assert(client->test->pointer_x == client->surface->x);
|
test_assert_int_eq(client->test->pointer_x, client->surface->x);
|
||||||
|
|
||||||
lock_destroy(&cs, client);
|
lock_destroy(&cs, client);
|
||||||
/* x-1 (after unlocking) */
|
/* x-1 (after unlocking) */
|
||||||
move_pointer(client, client->surface->x-1, client->surface->y);
|
move_pointer(client, client->surface->x-1, client->surface->y);
|
||||||
assert(client->input->pointer->focus != client->surface);
|
test_assert_ptr_ne(client->input->pointer->focus, client->surface);
|
||||||
assert(client->test->pointer_x == client->surface->x-1);
|
test_assert_int_eq(client->test->pointer_x, client->surface->x-1);
|
||||||
|
|
||||||
constraint_deinit(&cs);
|
constraint_deinit(&cs);
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -338,7 +339,7 @@ TEST(constraints_already_constrained)
|
||||||
/* try to lock an already confined pointer */
|
/* try to lock an already confined pointer */
|
||||||
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
||||||
assert(cs.pointer_is_confined);
|
test_assert_true(cs.pointer_is_confined);
|
||||||
cs.zwp_locked_pointer =
|
cs.zwp_locked_pointer =
|
||||||
zwp_pointer_constraints_v1_lock_pointer(cs.zwp_pointer_constraints,
|
zwp_pointer_constraints_v1_lock_pointer(cs.zwp_pointer_constraints,
|
||||||
client->surface->wl_surface,
|
client->surface->wl_surface,
|
||||||
|
|
@ -362,7 +363,7 @@ TEST(constraints_already_constrained)
|
||||||
/* try to confine an already locked pointer */
|
/* try to confine an already locked pointer */
|
||||||
lock_pointer(&cs, client, &locked_pointer_listener, NULL,
|
lock_pointer(&cs, client, &locked_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
||||||
assert(cs.pointer_is_locked);
|
test_assert_true(cs.pointer_is_locked);
|
||||||
cs.zwp_confined_pointer =
|
cs.zwp_confined_pointer =
|
||||||
zwp_pointer_constraints_v1_confine_pointer(cs.zwp_pointer_constraints,
|
zwp_pointer_constraints_v1_confine_pointer(cs.zwp_pointer_constraints,
|
||||||
client->surface->wl_surface,
|
client->surface->wl_surface,
|
||||||
|
|
@ -396,7 +397,7 @@ TEST(constraints_shell_activate_input)
|
||||||
|
|
||||||
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
||||||
assert(!cs.pointer_is_confined);
|
test_assert_false(cs.pointer_is_confined);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This mimics the desktop shell when activating input for the view in
|
* This mimics the desktop shell when activating input for the view in
|
||||||
|
|
@ -405,12 +406,12 @@ TEST(constraints_shell_activate_input)
|
||||||
weston_test_activate_surface(client->test->weston_test,
|
weston_test_activate_surface(client->test->weston_test,
|
||||||
client->surface->wl_surface);
|
client->surface->wl_surface);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(!cs.pointer_is_confined);
|
test_assert_false(cs.pointer_is_confined);
|
||||||
|
|
||||||
/* activation that comes from clicking inside the surface */
|
/* activation that comes from clicking inside the surface */
|
||||||
click_pointer(client);
|
click_pointer(client);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(cs.pointer_is_confined);
|
test_assert_true(cs.pointer_is_confined);
|
||||||
|
|
||||||
constraint_deinit(&cs);
|
constraint_deinit(&cs);
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -426,7 +427,7 @@ TEST(constraints_pointer_focus)
|
||||||
|
|
||||||
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
confine_pointer(&cs, client, &confined_pointer_listener, NULL,
|
||||||
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_ONESHOT);
|
||||||
assert(!cs.pointer_is_confined);
|
test_assert_false(cs.pointer_is_confined);
|
||||||
|
|
||||||
/* focus out */
|
/* focus out */
|
||||||
move_pointer(client, 0, 0);
|
move_pointer(client, 0, 0);
|
||||||
|
|
@ -434,15 +435,15 @@ TEST(constraints_pointer_focus)
|
||||||
/* focus in: should not confine */
|
/* focus in: should not confine */
|
||||||
move_pointer(client, 150, 150);
|
move_pointer(client, 150, 150);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(!cs.pointer_is_confined);
|
test_assert_false(cs.pointer_is_confined);
|
||||||
|
|
||||||
/* confine */
|
/* confine */
|
||||||
click_pointer(client);
|
click_pointer(client);
|
||||||
assert(cs.pointer_is_confined);
|
test_assert_true(cs.pointer_is_confined);
|
||||||
|
|
||||||
/* focus out: should not unconfine */
|
/* focus out: should not unconfine */
|
||||||
move_pointer(client, 0, 0);
|
move_pointer(client, 0, 0);
|
||||||
assert(cs.pointer_is_confined);
|
test_assert_true(cs.pointer_is_confined);
|
||||||
|
|
||||||
constraint_deinit(&cs);
|
constraint_deinit(&cs);
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -39,12 +38,13 @@
|
||||||
#include "shared/string-helpers.h"
|
#include "shared/string-helpers.h"
|
||||||
|
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
#define ASSERT_STR_MATCH(_as, _bs) do { \
|
#define ASSERT_STR_MATCH(_as, _bs) do { \
|
||||||
const char *as = _as; \
|
const char *as = _as; \
|
||||||
const char *bs = _bs; \
|
const char *bs = _bs; \
|
||||||
assert(!!as == !!bs); \
|
test_assert_true(!!as == !!bs); \
|
||||||
assert(!as || strcmp(as, bs) == 0); \
|
test_assert_true(!as || strcmp(as, bs) == 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define ASSERT_STR_ARRAY_MATCH(_name, _aa, _ba) do { \
|
#define ASSERT_STR_ARRAY_MATCH(_name, _aa, _ba) do { \
|
||||||
|
|
@ -84,7 +84,7 @@ TEST(basic_env)
|
||||||
custom_env_set_env_var(&env, "ENV5", "five");
|
custom_env_set_env_var(&env, "ENV5", "five");
|
||||||
custom_env_set_env_var(&env, "ENV3", "four");
|
custom_env_set_env_var(&env, "ENV3", "four");
|
||||||
ASSERT_STR_ARRAY_MATCH("envp", custom_env_get_envp(&env), envp);
|
ASSERT_STR_ARRAY_MATCH("envp", custom_env_get_envp(&env), envp);
|
||||||
assert(env.env_finalized);
|
test_assert_true(env.env_finalized);
|
||||||
custom_env_fini(&env);
|
custom_env_fini(&env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,9 +99,9 @@ TEST(basic_env_arg)
|
||||||
custom_env_add_arg(&env, "arg3");
|
custom_env_add_arg(&env, "arg3");
|
||||||
|
|
||||||
ASSERT_STR_ARRAY_MATCH("envp", custom_env_get_envp(&env), DEFAULT_ENVP);
|
ASSERT_STR_ARRAY_MATCH("envp", custom_env_get_envp(&env), DEFAULT_ENVP);
|
||||||
assert(env.env_finalized);
|
test_assert_true(env.env_finalized);
|
||||||
ASSERT_STR_ARRAY_MATCH("argp", custom_env_get_argp(&env), argp);
|
ASSERT_STR_ARRAY_MATCH("argp", custom_env_get_argp(&env), argp);
|
||||||
assert(env.arg_finalized);
|
test_assert_true(env.arg_finalized);
|
||||||
custom_env_fini(&env);
|
custom_env_fini(&env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -60,25 +61,25 @@ DECLARE_FIXTURE_SETUP(fixture_setup);
|
||||||
TEST(seat_capabilities_test)
|
TEST(seat_capabilities_test)
|
||||||
{
|
{
|
||||||
struct client *cl = create_client_and_test_surface(100, 100, 100, 100);
|
struct client *cl = create_client_and_test_surface(100, 100, 100, 100);
|
||||||
assert(cl->input->caps == WL_SEAT_CAPABILITY_ALL);
|
test_assert_enum(cl->input->caps, WL_SEAT_CAPABILITY_ALL);
|
||||||
|
|
||||||
assert(cl->input->pointer);
|
test_assert_ptr_not_null(cl->input->pointer);
|
||||||
weston_test_device_release(cl->test->weston_test, "pointer");
|
weston_test_device_release(cl->test->weston_test, "pointer");
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
assert(!cl->input->pointer);
|
test_assert_ptr_null(cl->input->pointer);
|
||||||
assert(!(cl->input->caps & WL_SEAT_CAPABILITY_POINTER));
|
test_assert_bit_not_set(cl->input->caps, WL_SEAT_CAPABILITY_POINTER);
|
||||||
|
|
||||||
assert(cl->input->keyboard);
|
test_assert_ptr_not_null(cl->input->keyboard);
|
||||||
weston_test_device_release(cl->test->weston_test, "keyboard");
|
weston_test_device_release(cl->test->weston_test, "keyboard");
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
assert(!cl->input->keyboard);
|
test_assert_ptr_null(cl->input->keyboard);
|
||||||
assert(!(cl->input->caps & WL_SEAT_CAPABILITY_KEYBOARD));
|
test_assert_bit_not_set(cl->input->caps, WL_SEAT_CAPABILITY_KEYBOARD);
|
||||||
|
|
||||||
assert(cl->input->touch);
|
test_assert_ptr_not_null(cl->input->touch);
|
||||||
weston_test_device_release(cl->test->weston_test, "touch");
|
weston_test_device_release(cl->test->weston_test, "touch");
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
assert(!cl->input->touch);
|
test_assert_ptr_null(cl->input->touch);
|
||||||
assert(!(cl->input->caps & WL_SEAT_CAPABILITY_TOUCH));
|
test_assert_bit_not_set(cl->input->caps, WL_SEAT_CAPABILITY_TOUCH);
|
||||||
|
|
||||||
/* restore previous state */
|
/* restore previous state */
|
||||||
weston_test_device_add(cl->test->weston_test, "keyboard");
|
weston_test_device_add(cl->test->weston_test, "keyboard");
|
||||||
|
|
@ -86,9 +87,9 @@ TEST(seat_capabilities_test)
|
||||||
weston_test_device_add(cl->test->weston_test, "touch");
|
weston_test_device_add(cl->test->weston_test, "touch");
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(cl->input->pointer);
|
test_assert_ptr_not_null(cl->input->pointer);
|
||||||
assert(cl->input->keyboard);
|
test_assert_ptr_not_null(cl->input->keyboard);
|
||||||
assert(cl->input->touch);
|
test_assert_ptr_not_null(cl->input->touch);
|
||||||
|
|
||||||
/* add extra devices */
|
/* add extra devices */
|
||||||
weston_test_device_add(cl->test->weston_test, "keyboard");
|
weston_test_device_add(cl->test->weston_test, "keyboard");
|
||||||
|
|
@ -104,11 +105,11 @@ TEST(seat_capabilities_test)
|
||||||
|
|
||||||
/* we still should have all the capabilities, since the devices
|
/* we still should have all the capabilities, since the devices
|
||||||
* were doubled */
|
* were doubled */
|
||||||
assert(cl->input->caps == WL_SEAT_CAPABILITY_ALL);
|
test_assert_enum(cl->input->caps, WL_SEAT_CAPABILITY_ALL);
|
||||||
|
|
||||||
assert(cl->input->pointer);
|
test_assert_ptr_not_null(cl->input->pointer);
|
||||||
assert(cl->input->keyboard);
|
test_assert_ptr_not_null(cl->input->keyboard);
|
||||||
assert(cl->input->touch);
|
test_assert_ptr_not_null(cl->input->touch);
|
||||||
|
|
||||||
client_destroy(cl);
|
client_destroy(cl);
|
||||||
}
|
}
|
||||||
|
|
@ -128,11 +129,11 @@ TEST(multiple_device_add_and_remove)
|
||||||
|
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(cl->input->pointer);
|
test_assert_ptr_not_null(cl->input->pointer);
|
||||||
assert(cl->input->keyboard);
|
test_assert_ptr_not_null(cl->input->keyboard);
|
||||||
assert(cl->input->touch);
|
test_assert_ptr_not_null(cl->input->touch);
|
||||||
|
|
||||||
assert(cl->input->caps == WL_SEAT_CAPABILITY_ALL);
|
test_assert_enum(cl->input->caps, WL_SEAT_CAPABILITY_ALL);
|
||||||
|
|
||||||
/* release all new devices */
|
/* release all new devices */
|
||||||
for (i = 0; i < COUNT; ++i) {
|
for (i = 0; i < COUNT; ++i) {
|
||||||
|
|
@ -144,11 +145,11 @@ TEST(multiple_device_add_and_remove)
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
/* there is still one from each device left */
|
/* there is still one from each device left */
|
||||||
assert(cl->input->caps == WL_SEAT_CAPABILITY_ALL);
|
test_assert_enum(cl->input->caps, WL_SEAT_CAPABILITY_ALL);
|
||||||
|
|
||||||
assert(cl->input->pointer);
|
test_assert_ptr_not_null(cl->input->pointer);
|
||||||
assert(cl->input->keyboard);
|
test_assert_ptr_not_null(cl->input->keyboard);
|
||||||
assert(cl->input->touch);
|
test_assert_ptr_not_null(cl->input->touch);
|
||||||
|
|
||||||
client_destroy(cl);
|
client_destroy(cl);
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +181,7 @@ device_release_before_destroy(void)
|
||||||
weston_test_device_release(cl->test->weston_test, "touch");
|
weston_test_device_release(cl->test->weston_test, "touch");
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(cl->input->caps == 0);
|
test_assert_enum(cl->input->caps, 0);
|
||||||
|
|
||||||
/* restore previous state */
|
/* restore previous state */
|
||||||
weston_test_device_add(cl->test->weston_test, "pointer");
|
weston_test_device_add(cl->test->weston_test, "pointer");
|
||||||
|
|
@ -188,7 +189,7 @@ device_release_before_destroy(void)
|
||||||
weston_test_device_add(cl->test->weston_test, "touch");
|
weston_test_device_add(cl->test->weston_test, "touch");
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(cl->input->caps == WL_SEAT_CAPABILITY_ALL);
|
test_assert_enum(cl->input->caps, WL_SEAT_CAPABILITY_ALL);
|
||||||
|
|
||||||
client_destroy(cl);
|
client_destroy(cl);
|
||||||
}
|
}
|
||||||
|
|
@ -229,7 +230,7 @@ device_release_after_destroy(void)
|
||||||
|
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(cl->input->caps == 0);
|
test_assert_enum(cl->input->caps, 0);
|
||||||
|
|
||||||
/* restore previous state */
|
/* restore previous state */
|
||||||
weston_test_device_add(cl->test->weston_test, "pointer");
|
weston_test_device_add(cl->test->weston_test, "pointer");
|
||||||
|
|
@ -237,7 +238,7 @@ device_release_after_destroy(void)
|
||||||
weston_test_device_add(cl->test->weston_test, "touch");
|
weston_test_device_add(cl->test->weston_test, "touch");
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(cl->input->caps == WL_SEAT_CAPABILITY_ALL);
|
test_assert_enum(cl->input->caps, WL_SEAT_CAPABILITY_ALL);
|
||||||
|
|
||||||
client_destroy(cl);
|
client_destroy(cl);
|
||||||
}
|
}
|
||||||
|
|
@ -283,7 +284,7 @@ get_device_after_destroy(void)
|
||||||
* exactly simulate our situation */
|
* exactly simulate our situation */
|
||||||
weston_test_device_release(cl->test->weston_test, "pointer");
|
weston_test_device_release(cl->test->weston_test, "pointer");
|
||||||
wl_pointer = wl_seat_get_pointer(cl->input->wl_seat);
|
wl_pointer = wl_seat_get_pointer(cl->input->wl_seat);
|
||||||
assert(wl_pointer);
|
test_assert_ptr_not_null(wl_pointer);
|
||||||
|
|
||||||
/* this should be ignored */
|
/* this should be ignored */
|
||||||
wl_pointer_set_cursor(wl_pointer, 0, NULL, 0, 0);
|
wl_pointer_set_cursor(wl_pointer, 0, NULL, 0, 0);
|
||||||
|
|
@ -294,13 +295,13 @@ get_device_after_destroy(void)
|
||||||
|
|
||||||
weston_test_device_release(cl->test->weston_test, "keyboard");
|
weston_test_device_release(cl->test->weston_test, "keyboard");
|
||||||
wl_keyboard = wl_seat_get_keyboard(cl->input->wl_seat);
|
wl_keyboard = wl_seat_get_keyboard(cl->input->wl_seat);
|
||||||
assert(wl_keyboard);
|
test_assert_ptr_not_null(wl_keyboard);
|
||||||
wl_keyboard_release(wl_keyboard);
|
wl_keyboard_release(wl_keyboard);
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
weston_test_device_release(cl->test->weston_test, "touch");
|
weston_test_device_release(cl->test->weston_test, "touch");
|
||||||
wl_touch = wl_seat_get_touch(cl->input->wl_seat);
|
wl_touch = wl_seat_get_touch(cl->input->wl_seat);
|
||||||
assert(wl_touch);
|
test_assert_ptr_not_null(wl_touch);
|
||||||
wl_touch_release(wl_touch);
|
wl_touch_release(wl_touch);
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
|
|
@ -310,7 +311,7 @@ get_device_after_destroy(void)
|
||||||
weston_test_device_add(cl->test->weston_test, "touch");
|
weston_test_device_add(cl->test->weston_test, "touch");
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(cl->input->caps == WL_SEAT_CAPABILITY_ALL);
|
test_assert_enum(cl->input->caps, WL_SEAT_CAPABILITY_ALL);
|
||||||
|
|
||||||
client_destroy(cl);
|
client_destroy(cl);
|
||||||
}
|
}
|
||||||
|
|
@ -332,7 +333,7 @@ TEST(seats_have_names)
|
||||||
struct input *input;
|
struct input *input;
|
||||||
|
|
||||||
wl_list_for_each(input, &cl->inputs, link) {
|
wl_list_for_each(input, &cl->inputs, link) {
|
||||||
assert(input->seat_name);
|
test_assert_ptr_not_null(input->seat_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
client_destroy(cl);
|
client_destroy(cl);
|
||||||
|
|
@ -346,7 +347,7 @@ TEST(seat_destroy_and_recreate)
|
||||||
/* Roundtrip to receive and handle the seat global removal event */
|
/* Roundtrip to receive and handle the seat global removal event */
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(!cl->input);
|
test_assert_ptr_null(cl->input);
|
||||||
|
|
||||||
weston_test_device_add(cl->test->weston_test, "seat");
|
weston_test_device_add(cl->test->weston_test, "seat");
|
||||||
/* First roundtrip to send request and receive new seat global */
|
/* First roundtrip to send request and receive new seat global */
|
||||||
|
|
@ -354,10 +355,10 @@ TEST(seat_destroy_and_recreate)
|
||||||
/* Second roundtrip to handle seat events and set up input devices */
|
/* Second roundtrip to handle seat events and set up input devices */
|
||||||
client_roundtrip(cl);
|
client_roundtrip(cl);
|
||||||
|
|
||||||
assert(cl->input);
|
test_assert_ptr_not_null(cl->input);
|
||||||
assert(cl->input->pointer);
|
test_assert_ptr_not_null(cl->input->pointer);
|
||||||
assert(cl->input->keyboard);
|
test_assert_ptr_not_null(cl->input->keyboard);
|
||||||
assert(cl->input->touch);
|
test_assert_ptr_not_null(cl->input->touch);
|
||||||
|
|
||||||
client_destroy(cl);
|
client_destroy(cl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,13 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <libweston/libweston.h>
|
#include <libweston/libweston.h>
|
||||||
#include <libweston-internal.h>
|
#include <libweston-internal.h>
|
||||||
#include "shared/weston-drm-fourcc.h"
|
#include "shared/weston-drm-fourcc.h"
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
/* Add multiple formats to weston_drm_format_array and add the same set of
|
/* Add multiple formats to weston_drm_format_array and add the same set of
|
||||||
* modifiers to each format. */
|
* modifiers to each format. */
|
||||||
|
|
@ -63,11 +62,11 @@ format_array_add_format_and_modifiers(struct weston_drm_format_array *formats,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
fmt = weston_drm_format_array_add_format(formats, format);
|
fmt = weston_drm_format_array_add_format(formats, format);
|
||||||
assert(fmt);
|
test_assert_ptr_not_null(fmt);
|
||||||
|
|
||||||
for (i = 0; i < num_modifiers; i++) {
|
for (i = 0; i < num_modifiers; i++) {
|
||||||
ret = weston_drm_format_add_modifier(fmt, modifiers[i]);
|
ret = weston_drm_format_add_modifier(fmt, modifiers[i]);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -81,19 +80,20 @@ TEST(basic_operations)
|
||||||
|
|
||||||
weston_drm_format_array_init(&format_array);
|
weston_drm_format_array_init(&format_array);
|
||||||
|
|
||||||
assert(weston_drm_format_array_count_pairs(&format_array) == 0);
|
test_assert_int_eq(weston_drm_format_array_count_pairs(&format_array), 0);
|
||||||
|
|
||||||
ADD_FORMATS_AND_MODS(&format_array, formats, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array, formats, modifiers);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(formats); i++) {
|
for (i = 0; i < ARRAY_LENGTH(formats); i++) {
|
||||||
fmt = weston_drm_format_array_find_format(&format_array, formats[i]);
|
fmt = weston_drm_format_array_find_format(&format_array, formats[i]);
|
||||||
assert(fmt && fmt->format == formats[i]);
|
test_assert_ptr_not_null(fmt);
|
||||||
|
test_assert_u32_eq(fmt->format, formats[i]);
|
||||||
for (j = 0; j < ARRAY_LENGTH(modifiers); j++)
|
for (j = 0; j < ARRAY_LENGTH(modifiers); j++)
|
||||||
assert(weston_drm_format_has_modifier(fmt, modifiers[j]));
|
test_assert_true(weston_drm_format_has_modifier(fmt, modifiers[j]));
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(weston_drm_format_array_count_pairs(&format_array) ==
|
test_assert_uint_eq(weston_drm_format_array_count_pairs(&format_array),
|
||||||
ARRAY_LENGTH(formats) * ARRAY_LENGTH(modifiers));
|
ARRAY_LENGTH(formats) * ARRAY_LENGTH(modifiers));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array);
|
weston_drm_format_array_fini(&format_array);
|
||||||
}
|
}
|
||||||
|
|
@ -108,12 +108,12 @@ TEST(compare_arrays_same_content)
|
||||||
weston_drm_format_array_init(&format_array_B);
|
weston_drm_format_array_init(&format_array_B);
|
||||||
|
|
||||||
/* Both are empty arrays, so they have the same content. */
|
/* Both are empty arrays, so they have the same content. */
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
||||||
|
|
||||||
/* Test non-empty arrays with same content. */
|
/* Test non-empty arrays with same content. */
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats, modifiers);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
||||||
|
|
||||||
/* Test non-empty arrays with same content, but add elements to B in
|
/* Test non-empty arrays with same content, but add elements to B in
|
||||||
* reverse order. This is important as in the future we may keep
|
* reverse order. This is important as in the future we may keep
|
||||||
|
|
@ -121,7 +121,7 @@ TEST(compare_arrays_same_content)
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
weston_drm_format_array_init(&format_array_B);
|
weston_drm_format_array_init(&format_array_B);
|
||||||
ADD_FORMATS_AND_MODS_REVERSE(&format_array_B, formats, modifiers);
|
ADD_FORMATS_AND_MODS_REVERSE(&format_array_B, formats, modifiers);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -141,7 +141,8 @@ TEST(compare_arrays_exclusive_content)
|
||||||
/* Arrays with formats that are mutually exclusive. */
|
/* Arrays with formats that are mutually exclusive. */
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers_A);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers_A);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers_B);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers_B);
|
||||||
assert(!weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_false(weston_drm_format_array_equal(&format_array_A,
|
||||||
|
&format_array_B));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -161,8 +162,8 @@ TEST(replace_array)
|
||||||
* have the same content. */
|
* have the same content. */
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
||||||
ret = weston_drm_format_array_replace(&format_array_B, &format_array_A);
|
ret = weston_drm_format_array_replace(&format_array_B, &format_array_A);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -185,12 +186,12 @@ TEST(remove_from_array)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers);
|
||||||
weston_drm_format_array_remove_latest_format(&format_array_A);
|
weston_drm_format_array_remove_latest_format(&format_array_A);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
||||||
|
|
||||||
/* Add 6 to the format array A, so it should be equal to C. */
|
/* Add 6 to the format array A, so it should be equal to C. */
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, (uint32_t[]){6}, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, (uint32_t[]){6}, modifiers);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, formats_C, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_C, formats_C, modifiers);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -215,7 +216,7 @@ TEST(join_arrays)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers_A);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers_A);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers_B);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers_B);
|
||||||
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
|
|
||||||
/* The result of the joint (which is saved in A) should have
|
/* The result of the joint (which is saved in A) should have
|
||||||
* the same content as C. */
|
* the same content as C. */
|
||||||
|
|
@ -226,7 +227,7 @@ TEST(join_arrays)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){7}, modifiers_B);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){7}, modifiers_B);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){9}, modifiers_join);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){9}, modifiers_join);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){10}, modifiers_join);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){10}, modifiers_join);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -245,21 +246,21 @@ TEST(join_arrays_same_content)
|
||||||
|
|
||||||
/* Joint of empty arrays must be empty. */
|
/* Joint of empty arrays must be empty. */
|
||||||
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(format_array_A.arr.size == 0);
|
test_assert_u64_eq(format_array_A.arr.size, 0);
|
||||||
|
|
||||||
/* Join B, which is empty, with A, which is non-empty. The joint (which
|
/* Join B, which is empty, with A, which is non-empty. The joint (which
|
||||||
* is saved in B) should have the same content as A. */
|
* is saved in B) should have the same content as A. */
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
||||||
ret = weston_drm_format_array_join(&format_array_B, &format_array_A);
|
ret = weston_drm_format_array_join(&format_array_B, &format_array_A);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
||||||
|
|
||||||
/* Now A and B are non-empty and have the same content. The joint (which
|
/* Now A and B are non-empty and have the same content. The joint (which
|
||||||
* is saved in A) should not change its content. */
|
* is saved in A) should not change its content. */
|
||||||
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -284,8 +285,8 @@ TEST(join_arrays_exclusive_content)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, formats_C, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_C, formats_C, modifiers);
|
||||||
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -312,8 +313,8 @@ TEST(join_arrays_modifier_invalid)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, (uint32_t[]){1}, regular_modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_B, (uint32_t[]){1}, regular_modifiers);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){1}, regular_modifiers_plus_invalid);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){1}, regular_modifiers_plus_invalid);
|
||||||
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_join(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -338,14 +339,14 @@ TEST(intersect_arrays)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers_A);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers_A);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers_B);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers_B);
|
||||||
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
|
|
||||||
/* The result of the intersection (stored in A) should have the same
|
/* The result of the intersection (stored in A) should have the same
|
||||||
* content as C. */
|
* content as C. */
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){2}, modifiers_intersect);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){2}, modifiers_intersect);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){9}, modifiers_intersect);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){9}, modifiers_intersect);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){10}, modifiers_intersect);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){10}, modifiers_intersect);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -365,18 +366,18 @@ TEST(intersect_arrays_same_content)
|
||||||
/* The intersection between two empty arrays must be an
|
/* The intersection between two empty arrays must be an
|
||||||
* empty array. */
|
* empty array. */
|
||||||
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(format_array_A.arr.size == 0);
|
test_assert_u64_eq(format_array_A.arr.size, 0);
|
||||||
|
|
||||||
/* DRM-format arrays A and B have the same content, so the intersection
|
/* DRM-format arrays A and B have the same content, so the intersection
|
||||||
* should be equal to them. A keeps the result of the intersection, and B
|
* should be equal to them. A keeps the result of the intersection, and B
|
||||||
* does not change. So we compare them. */
|
* does not change. So we compare them. */
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
||||||
ret = weston_drm_format_array_replace(&format_array_B, &format_array_A);
|
ret = weston_drm_format_array_replace(&format_array_B, &format_array_A);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_B));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -398,8 +399,8 @@ TEST(intersect_arrays_exclusive_formats)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers);
|
||||||
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(format_array_A.arr.size == 0);
|
test_assert_u64_eq(format_array_A.arr.size, 0);
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -423,8 +424,8 @@ TEST(intersect_arrays_exclusive_modifiers)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, (uint32_t[]){1}, modifiers_A);
|
ADD_FORMATS_AND_MODS(&format_array_A, (uint32_t[]){1}, modifiers_A);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, (uint32_t[]){1}, modifiers_B);
|
ADD_FORMATS_AND_MODS(&format_array_B, (uint32_t[]){1}, modifiers_B);
|
||||||
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_intersect(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(format_array_A.arr.size == 0);
|
test_assert_u64_eq(format_array_A.arr.size, 0);
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -448,7 +449,7 @@ TEST(subtract_arrays)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers_A);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers_A);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers_B);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers_B);
|
||||||
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
|
|
||||||
/* The result of the subtraction (which is saved in A) should have
|
/* The result of the subtraction (which is saved in A) should have
|
||||||
* the same content as C. */
|
* the same content as C. */
|
||||||
|
|
@ -457,7 +458,7 @@ TEST(subtract_arrays)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){6}, modifiers_A);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){6}, modifiers_A);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){9}, modifiers_subtract);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){9}, modifiers_subtract);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){10}, modifiers_subtract);
|
ADD_FORMATS_AND_MODS(&format_array_C, (uint32_t[]){10}, modifiers_subtract);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -478,10 +479,10 @@ TEST(subtract_arrays_same_content)
|
||||||
* (which is saved in A) should be an empty array. */
|
* (which is saved in A) should be an empty array. */
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats, modifiers);
|
||||||
ret = weston_drm_format_array_replace(&format_array_B, &format_array_A);
|
ret = weston_drm_format_array_replace(&format_array_B, &format_array_A);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(format_array_A.arr.size == 0);
|
test_assert_u64_eq(format_array_A.arr.size, 0);
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -505,11 +506,11 @@ TEST(subtract_arrays_exclusive_formats)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_A, formats_A, modifiers);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers);
|
ADD_FORMATS_AND_MODS(&format_array_B, formats_B, modifiers);
|
||||||
ret = weston_drm_format_array_replace(&format_array_C, &format_array_A);
|
ret = weston_drm_format_array_replace(&format_array_C, &format_array_A);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
|
|
||||||
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -534,11 +535,11 @@ TEST(subtract_arrays_exclusive_modifiers)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, (uint32_t[]){1}, modifiers_A);
|
ADD_FORMATS_AND_MODS(&format_array_A, (uint32_t[]){1}, modifiers_A);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, (uint32_t[]){1}, modifiers_B);
|
ADD_FORMATS_AND_MODS(&format_array_B, (uint32_t[]){1}, modifiers_B);
|
||||||
ret = weston_drm_format_array_replace(&format_array_C, &format_array_A);
|
ret = weston_drm_format_array_replace(&format_array_C, &format_array_A);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
|
|
||||||
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
test_assert_true(weston_drm_format_array_equal(&format_array_A, &format_array_C));
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
@ -564,8 +565,8 @@ TEST(subtract_arrays_modifier_invalid)
|
||||||
ADD_FORMATS_AND_MODS(&format_array_A, (uint32_t[]){1}, modifier_invalid);
|
ADD_FORMATS_AND_MODS(&format_array_A, (uint32_t[]){1}, modifier_invalid);
|
||||||
ADD_FORMATS_AND_MODS(&format_array_B, (uint32_t[]){1}, regular_modifiers_plus_invalid);
|
ADD_FORMATS_AND_MODS(&format_array_B, (uint32_t[]){1}, regular_modifiers_plus_invalid);
|
||||||
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
ret = weston_drm_format_array_subtract(&format_array_A, &format_array_B);
|
||||||
assert(ret == 0);
|
test_assert_int_eq(ret, 0);
|
||||||
assert(format_array_A.arr.size == 0);
|
test_assert_u64_eq(format_array_A.arr.size, 0);
|
||||||
|
|
||||||
weston_drm_format_array_fini(&format_array_A);
|
weston_drm_format_array_fini(&format_array_A);
|
||||||
weston_drm_format_array_fini(&format_array_B);
|
weston_drm_format_array_fini(&format_array_B);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -53,7 +54,7 @@ TEST(drm_smoke) {
|
||||||
color_rgb888(&red, 255, 0, 0);
|
color_rgb888(&red, 255, 0, 0);
|
||||||
|
|
||||||
client = create_client_and_test_surface(0, 0, 200, 200);
|
client = create_client_and_test_surface(0, 0, 200, 200);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
surface = client->surface->wl_surface;
|
surface = client->surface->wl_surface;
|
||||||
buffer = create_shm_buffer_a8r8g8b8(client, 200, 200);
|
buffer = create_shm_buffer_a8r8g8b8(client, 200, 200);
|
||||||
|
|
@ -78,7 +79,7 @@ TEST(drm_screenshot_no_damage) {
|
||||||
bool ret;
|
bool ret;
|
||||||
|
|
||||||
client = create_client_and_test_surface(0, 0, 200, 200);
|
client = create_client_and_test_surface(0, 0, 200, 200);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DRM-backend has an optimization to not even call the renderer if
|
* DRM-backend has an optimization to not even call the renderer if
|
||||||
|
|
@ -92,7 +93,7 @@ TEST(drm_screenshot_no_damage) {
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
ret = verify_screen_content(client, "drm_screenshot_no_damage",
|
ret = verify_screen_content(client, "drm_screenshot_no_damage",
|
||||||
0, NULL, i, "Virtual-1");
|
0, NULL, i, "Virtual-1");
|
||||||
assert(ret);
|
test_assert_true(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
#include "weston-output-capture-client-protocol.h"
|
#include "weston-output-capture-client-protocol.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -65,7 +66,7 @@ draw_stuff(pixman_image_t *image)
|
||||||
stride = pixman_image_get_stride(image);
|
stride = pixman_image_get_stride(image);
|
||||||
pixels = pixman_image_get_data(image);
|
pixels = pixman_image_get_data(image);
|
||||||
|
|
||||||
assert(PIXMAN_FORMAT_BPP(fmt) == 32);
|
test_assert_int_eq(PIXMAN_FORMAT_BPP(fmt), 32);
|
||||||
|
|
||||||
for (x = 0; x < w; x++)
|
for (x = 0; x < w; x++)
|
||||||
for (y = 0; y < h; y++) {
|
for (y = 0; y < h; y++) {
|
||||||
|
|
@ -93,7 +94,7 @@ TEST(drm_writeback_screenshot) {
|
||||||
/* create client */
|
/* create client */
|
||||||
testlog("Creating client for test\n");
|
testlog("Creating client for test\n");
|
||||||
client = create_client_and_test_surface(100, 100, 100, 100);
|
client = create_client_and_test_surface(100, 100, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
surface = client->surface->wl_surface;
|
surface = client->surface->wl_surface;
|
||||||
|
|
||||||
/* move pointer away from image so it does not interfere with the
|
/* move pointer away from image so it does not interfere with the
|
||||||
|
|
@ -113,7 +114,7 @@ TEST(drm_writeback_screenshot) {
|
||||||
testlog("Taking a screenshot\n");
|
testlog("Taking a screenshot\n");
|
||||||
screenshot = client_capture_output(client, client->output,
|
screenshot = client_capture_output(client, client->output,
|
||||||
WESTON_CAPTURE_V1_SOURCE_WRITEBACK);
|
WESTON_CAPTURE_V1_SOURCE_WRITEBACK);
|
||||||
assert(screenshot);
|
test_assert_ptr_not_null(screenshot);
|
||||||
buffer_destroy(screenshot);
|
buffer_destroy(screenshot);
|
||||||
|
|
||||||
/* take another screenshot; this is important to ensure the
|
/* take another screenshot; this is important to ensure the
|
||||||
|
|
@ -121,13 +122,13 @@ TEST(drm_writeback_screenshot) {
|
||||||
testlog("Taking another screenshot\n");
|
testlog("Taking another screenshot\n");
|
||||||
screenshot = client_capture_output(client, client->output,
|
screenshot = client_capture_output(client, client->output,
|
||||||
WESTON_CAPTURE_V1_SOURCE_WRITEBACK);
|
WESTON_CAPTURE_V1_SOURCE_WRITEBACK);
|
||||||
assert(screenshot);
|
test_assert_ptr_not_null(screenshot);
|
||||||
|
|
||||||
/* load reference image */
|
/* load reference image */
|
||||||
fname = screenshot_reference_filename("drm-writeback-screenshot", 0);
|
fname = screenshot_reference_filename("drm-writeback-screenshot", 0);
|
||||||
testlog("Loading good reference image %s\n", fname);
|
testlog("Loading good reference image %s\n", fname);
|
||||||
reference = load_image_from_png(fname);
|
reference = load_image_from_png(fname);
|
||||||
assert(reference);
|
test_assert_ptr_not_null(reference);
|
||||||
free(fname);
|
free(fname);
|
||||||
|
|
||||||
/* check if they match - only the colored square matters, so the
|
/* check if they match - only the colored square matters, so the
|
||||||
|
|
@ -151,5 +152,5 @@ TEST(drm_writeback_screenshot) {
|
||||||
buffer_destroy(buffer);
|
buffer_destroy(buffer);
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -60,9 +61,9 @@ check_client_move(struct client *client, int x, int y)
|
||||||
move_client_offscreenable(client, x, y);
|
move_client_offscreenable(client, x, y);
|
||||||
|
|
||||||
if (output_contains_client(client)) {
|
if (output_contains_client(client)) {
|
||||||
assert(client->surface->output == client->output);
|
test_assert_ptr_eq(client->surface->output, client->output);
|
||||||
} else {
|
} else {
|
||||||
assert(client->surface->output == NULL);
|
test_assert_ptr_null(client->surface->output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,9 +73,9 @@ TEST(test_surface_output)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 100, 100, 100);
|
client = create_client_and_test_surface(100, 100, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
assert(output_contains_client(client));
|
test_assert_true(output_contains_client(client));
|
||||||
|
|
||||||
/* not visible */
|
/* not visible */
|
||||||
x = 0;
|
x = 0;
|
||||||
|
|
@ -99,17 +100,17 @@ TEST(test_surface_output)
|
||||||
|
|
||||||
/* visible */
|
/* visible */
|
||||||
check_client_move(client, --x, y);
|
check_client_move(client, --x, y);
|
||||||
assert(output_contains_client(client));
|
test_assert_true(output_contains_client(client));
|
||||||
|
|
||||||
/* not visible */
|
/* not visible */
|
||||||
x = 0;
|
x = 0;
|
||||||
y = client->output->height;
|
y = client->output->height;
|
||||||
check_client_move(client, x, y);
|
check_client_move(client, x, y);
|
||||||
assert(!output_contains_client(client));
|
test_assert_false(output_contains_client(client));
|
||||||
|
|
||||||
/* visible */
|
/* visible */
|
||||||
check_client_move(client, x, --y);
|
check_client_move(client, x, --y);
|
||||||
assert(output_contains_client(client));
|
test_assert_true(output_contains_client(client));
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +140,7 @@ TEST(buffer_release)
|
||||||
int frame;
|
int frame;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 100, 100, 100);
|
client = create_client_and_test_surface(100, 100, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
surface = client->surface->wl_surface;
|
surface = client->surface->wl_surface;
|
||||||
|
|
||||||
buf1 = create_shm_buffer_a8r8g8b8(client, 100, 100);
|
buf1 = create_shm_buffer_a8r8g8b8(client, 100, 100);
|
||||||
|
|
@ -161,25 +162,25 @@ TEST(buffer_release)
|
||||||
frame_callback_set(surface, &frame);
|
frame_callback_set(surface, &frame);
|
||||||
wl_surface_commit(surface);
|
wl_surface_commit(surface);
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
assert(buf1_released == 0);
|
test_assert_int_eq(buf1_released, 0);
|
||||||
/* buf2 may or may not be released */
|
/* buf2 may or may not be released */
|
||||||
assert(buf3_released == 0);
|
test_assert_int_eq(buf3_released, 0);
|
||||||
|
|
||||||
wl_surface_attach(surface, buf3->proxy, 0, 0);
|
wl_surface_attach(surface, buf3->proxy, 0, 0);
|
||||||
frame_callback_set(surface, &frame);
|
frame_callback_set(surface, &frame);
|
||||||
wl_surface_commit(surface);
|
wl_surface_commit(surface);
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
assert(buf1_released == 0);
|
test_assert_int_eq(buf1_released, 0);
|
||||||
assert(buf2_released == 1);
|
test_assert_int_eq(buf2_released, 1);
|
||||||
/* buf3 may or may not be released */
|
/* buf3 may or may not be released */
|
||||||
|
|
||||||
wl_surface_attach(surface, client->surface->buffer->proxy, 0, 0);
|
wl_surface_attach(surface, client->surface->buffer->proxy, 0, 0);
|
||||||
frame_callback_set(surface, &frame);
|
frame_callback_set(surface, &frame);
|
||||||
wl_surface_commit(surface);
|
wl_surface_commit(surface);
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
assert(buf1_released == 0);
|
test_assert_int_eq(buf1_released, 0);
|
||||||
assert(buf2_released == 1);
|
test_assert_int_eq(buf2_released, 1);
|
||||||
assert(buf3_released == 1);
|
test_assert_int_eq(buf3_released, 1);
|
||||||
|
|
||||||
buffer_destroy(buf1);
|
buffer_destroy(buf1);
|
||||||
buffer_destroy(buf2);
|
buffer_destroy(buf2);
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,8 @@
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pixman.h>
|
#include <pixman.h>
|
||||||
#include <assert.h>
|
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
/** A collection of basic information extracted from a pixman_image_t */
|
/** A collection of basic information extracted from a pixman_image_t */
|
||||||
struct image_header {
|
struct image_header {
|
||||||
|
|
@ -67,9 +68,9 @@ image_header_from(pixman_image_t *image)
|
||||||
static inline uint32_t *
|
static inline uint32_t *
|
||||||
image_header_get_row_u32(const struct image_header *header, int y)
|
image_header_get_row_u32(const struct image_header *header, int y)
|
||||||
{
|
{
|
||||||
assert(y >= 0);
|
test_assert_int_ge(y, 0);
|
||||||
assert(y < header->height);
|
test_assert_int_lt(y, header->height);
|
||||||
assert(PIXMAN_FORMAT_BPP(header->pixman_format) == 32);
|
test_assert_int_eq(PIXMAN_FORMAT_BPP(header->pixman_format), 32);
|
||||||
|
|
||||||
return (uint32_t *)(header->data + y * header->stride_bytes);
|
return (uint32_t *)(header->data + y * header->stride_bytes);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
@ -35,6 +34,7 @@
|
||||||
#include "shared/timespec-util.h"
|
#include "shared/timespec-util.h"
|
||||||
#include <libweston/zalloc.h>
|
#include <libweston/zalloc.h>
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
struct input_timestamps {
|
struct input_timestamps {
|
||||||
struct zwp_input_timestamps_v1 *proxy;
|
struct zwp_input_timestamps_v1 *proxy;
|
||||||
|
|
@ -51,18 +51,18 @@ get_input_timestamps_manager(struct client *client)
|
||||||
if (strcmp(g->interface, zwp_input_timestamps_manager_v1_interface.name))
|
if (strcmp(g->interface, zwp_input_timestamps_manager_v1_interface.name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_ts)
|
/* Can't have multiple input timestamp managers. */
|
||||||
assert(!"Multiple input timestamp managers");
|
test_assert_ptr_null(global_ts);
|
||||||
|
|
||||||
global_ts = g;
|
global_ts = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_ts);
|
test_assert_ptr_not_null(global_ts);
|
||||||
assert(global_ts->version == 1);
|
test_assert_u32_eq(global_ts->version, 1);
|
||||||
|
|
||||||
ts = wl_registry_bind(client->wl_registry, global_ts->name,
|
ts = wl_registry_bind(client->wl_registry, global_ts->name,
|
||||||
&zwp_input_timestamps_manager_v1_interface, 1);
|
&zwp_input_timestamps_manager_v1_interface, 1);
|
||||||
assert(ts);
|
test_assert_ptr_not_null(ts);
|
||||||
|
|
||||||
return ts;
|
return ts;
|
||||||
}
|
}
|
||||||
|
|
@ -97,12 +97,12 @@ input_timestamps_create_for_keyboard(struct client *client)
|
||||||
struct input_timestamps *input_ts;
|
struct input_timestamps *input_ts;
|
||||||
|
|
||||||
input_ts = zalloc(sizeof *input_ts);
|
input_ts = zalloc(sizeof *input_ts);
|
||||||
assert(input_ts);
|
test_assert_ptr_not_null(input_ts);
|
||||||
|
|
||||||
input_ts->proxy =
|
input_ts->proxy =
|
||||||
zwp_input_timestamps_manager_v1_get_keyboard_timestamps(
|
zwp_input_timestamps_manager_v1_get_keyboard_timestamps(
|
||||||
manager, client->input->keyboard->wl_keyboard);
|
manager, client->input->keyboard->wl_keyboard);
|
||||||
assert(input_ts->proxy);
|
test_assert_ptr_not_null(input_ts->proxy);
|
||||||
|
|
||||||
zwp_input_timestamps_v1_add_listener(input_ts->proxy,
|
zwp_input_timestamps_v1_add_listener(input_ts->proxy,
|
||||||
&input_timestamps_listener,
|
&input_timestamps_listener,
|
||||||
|
|
@ -124,12 +124,12 @@ input_timestamps_create_for_pointer(struct client *client)
|
||||||
struct input_timestamps *input_ts;
|
struct input_timestamps *input_ts;
|
||||||
|
|
||||||
input_ts = zalloc(sizeof *input_ts);
|
input_ts = zalloc(sizeof *input_ts);
|
||||||
assert(input_ts);
|
test_assert_ptr_not_null(input_ts);
|
||||||
|
|
||||||
input_ts->proxy =
|
input_ts->proxy =
|
||||||
zwp_input_timestamps_manager_v1_get_pointer_timestamps(
|
zwp_input_timestamps_manager_v1_get_pointer_timestamps(
|
||||||
manager, client->input->pointer->wl_pointer);
|
manager, client->input->pointer->wl_pointer);
|
||||||
assert(input_ts->proxy);
|
test_assert_ptr_not_null(input_ts->proxy);
|
||||||
|
|
||||||
zwp_input_timestamps_v1_add_listener(input_ts->proxy,
|
zwp_input_timestamps_v1_add_listener(input_ts->proxy,
|
||||||
&input_timestamps_listener,
|
&input_timestamps_listener,
|
||||||
|
|
@ -151,12 +151,12 @@ input_timestamps_create_for_touch(struct client *client)
|
||||||
struct input_timestamps *input_ts;
|
struct input_timestamps *input_ts;
|
||||||
|
|
||||||
input_ts = zalloc(sizeof *input_ts);
|
input_ts = zalloc(sizeof *input_ts);
|
||||||
assert(input_ts);
|
test_assert_ptr_not_null(input_ts);
|
||||||
|
|
||||||
input_ts->proxy =
|
input_ts->proxy =
|
||||||
zwp_input_timestamps_manager_v1_get_touch_timestamps(
|
zwp_input_timestamps_manager_v1_get_touch_timestamps(
|
||||||
manager, client->input->touch->wl_touch);
|
manager, client->input->touch->wl_touch);
|
||||||
assert(input_ts->proxy);
|
test_assert_ptr_not_null(input_ts->proxy);
|
||||||
|
|
||||||
zwp_input_timestamps_v1_add_listener(input_ts->proxy,
|
zwp_input_timestamps_v1_add_listener(input_ts->proxy,
|
||||||
&input_timestamps_listener,
|
&input_timestamps_listener,
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "image-iter.h"
|
#include "image-iter.h"
|
||||||
#include "test-config.h"
|
#include "test-config.h"
|
||||||
|
|
||||||
|
|
@ -90,7 +91,7 @@ TEST(internal_screenshot)
|
||||||
/* Create the client */
|
/* Create the client */
|
||||||
testlog("Creating client for test\n");
|
testlog("Creating client for test\n");
|
||||||
client = create_client_and_test_surface(100, 100, 100, 100);
|
client = create_client_and_test_surface(100, 100, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
surface = client->surface->wl_surface;
|
surface = client->surface->wl_surface;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -120,20 +121,20 @@ TEST(internal_screenshot)
|
||||||
/* Take a snapshot. Result will be in screenshot->wl_buffer. */
|
/* Take a snapshot. Result will be in screenshot->wl_buffer. */
|
||||||
testlog("Taking a screenshot\n");
|
testlog("Taking a screenshot\n");
|
||||||
screenshot = capture_screenshot_of_output(client, NULL);
|
screenshot = capture_screenshot_of_output(client, NULL);
|
||||||
assert(screenshot);
|
test_assert_ptr_not_null(screenshot);
|
||||||
|
|
||||||
/* Load good reference image */
|
/* Load good reference image */
|
||||||
fname = screenshot_reference_filename("internal-screenshot-good", 0);
|
fname = screenshot_reference_filename("internal-screenshot-good", 0);
|
||||||
testlog("Loading good reference image %s\n", fname);
|
testlog("Loading good reference image %s\n", fname);
|
||||||
reference_good = load_image_from_png(fname);
|
reference_good = load_image_from_png(fname);
|
||||||
assert(reference_good);
|
test_assert_ptr_not_null(reference_good);
|
||||||
free(fname);
|
free(fname);
|
||||||
|
|
||||||
/* Load bad reference image */
|
/* Load bad reference image */
|
||||||
fname = screenshot_reference_filename("internal-screenshot-bad", 0);
|
fname = screenshot_reference_filename("internal-screenshot-bad", 0);
|
||||||
testlog("Loading bad reference image %s\n", fname);
|
testlog("Loading bad reference image %s\n", fname);
|
||||||
reference_bad = load_image_from_png(fname);
|
reference_bad = load_image_from_png(fname);
|
||||||
assert(reference_bad);
|
test_assert_ptr_not_null(reference_bad);
|
||||||
free(fname);
|
free(fname);
|
||||||
|
|
||||||
/* Test check_images_match() without a clip.
|
/* Test check_images_match() without a clip.
|
||||||
|
|
@ -141,7 +142,7 @@ TEST(internal_screenshot)
|
||||||
*/
|
*/
|
||||||
match = check_images_match(screenshot->image, reference_bad, NULL, NULL);
|
match = check_images_match(screenshot->image, reference_bad, NULL, NULL);
|
||||||
testlog("Screenshot %s reference image\n", match? "equal to" : "different from");
|
testlog("Screenshot %s reference image\n", match? "equal to" : "different from");
|
||||||
assert(!match);
|
test_assert_false(match);
|
||||||
pixman_image_unref(reference_bad);
|
pixman_image_unref(reference_bad);
|
||||||
|
|
||||||
/* Test check_images_match() with clip.
|
/* Test check_images_match() with clip.
|
||||||
|
|
@ -174,7 +175,7 @@ TEST(internal_screenshot)
|
||||||
buffer_destroy(screenshot);
|
buffer_destroy(screenshot);
|
||||||
|
|
||||||
testlog("Test complete\n");
|
testlog("Test complete\n");
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -33,7 +32,7 @@
|
||||||
#include <libweston/weston-log.h>
|
#include <libweston/weston-log.h>
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -63,10 +62,10 @@ iterate_debug_scopes(struct weston_compositor *compositor)
|
||||||
const char *desc_name;
|
const char *desc_name;
|
||||||
|
|
||||||
scope_name = weston_log_scope_get_name(nscope);
|
scope_name = weston_log_scope_get_name(nscope);
|
||||||
assert(scope_name);
|
test_assert_ptr_not_null(scope_name);
|
||||||
|
|
||||||
desc_name = weston_log_scope_get_description(nscope);
|
desc_name = weston_log_scope_get_description(nscope);
|
||||||
assert(desc_name);
|
test_assert_ptr_not_null(desc_name);
|
||||||
|
|
||||||
weston_log("\tscope name: %s, desc: %s\n", scope_name, desc_name);
|
weston_log("\tscope name: %s, desc: %s\n", scope_name, desc_name);
|
||||||
|
|
||||||
|
|
@ -75,7 +74,7 @@ iterate_debug_scopes(struct weston_compositor *compositor)
|
||||||
}
|
}
|
||||||
weston_log("\n");
|
weston_log("\n");
|
||||||
|
|
||||||
assert(found_test_harness_debug_scope);
|
test_assert_true(found_test_harness_debug_scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLUGIN_TEST(iterate_default_debug_scopes)
|
PLUGIN_TEST(iterate_default_debug_scopes)
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include "ivi-application-client-protocol.h"
|
#include "ivi-application-client-protocol.h"
|
||||||
#include "ivi-test.h"
|
#include "ivi-test.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -82,19 +83,19 @@ client_create_runner(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_runner)
|
if (global_runner)
|
||||||
assert(0 && "multiple weston_test_runner objects");
|
test_assert_not_reached("multiple weston_test_runner objects");
|
||||||
|
|
||||||
global_runner = g;
|
global_runner = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_runner && "no weston_test_runner found");
|
test_assert_ptr_not_null(global_runner);
|
||||||
assert(global_runner->version == 1);
|
test_assert_u32_eq(global_runner->version, 1);
|
||||||
|
|
||||||
runner->test_runner = wl_registry_bind(client->wl_registry,
|
runner->test_runner = wl_registry_bind(client->wl_registry,
|
||||||
global_runner->name,
|
global_runner->name,
|
||||||
&weston_test_runner_interface,
|
&weston_test_runner_interface,
|
||||||
1);
|
1);
|
||||||
assert(runner->test_runner);
|
test_assert_ptr_not_null(runner->test_runner);
|
||||||
|
|
||||||
weston_test_runner_add_listener(runner->test_runner,
|
weston_test_runner_add_listener(runner->test_runner,
|
||||||
&test_runner_listener, runner);
|
&test_runner_listener, runner);
|
||||||
|
|
@ -120,7 +121,7 @@ runner_run(struct runner *runner, const char *test_name)
|
||||||
|
|
||||||
while (!runner->done) {
|
while (!runner->done) {
|
||||||
if (wl_display_dispatch(runner->client->wl_display) < 0)
|
if (wl_display_dispatch(runner->client->wl_display) < 0)
|
||||||
assert(0 && "runner wait");
|
test_assert_not_reached("runner wait");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,18 +137,18 @@ get_ivi_application(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_iviapp)
|
if (global_iviapp)
|
||||||
assert(0 && "multiple ivi_application objects");
|
test_assert_not_reached("multiple ivi_application objects");
|
||||||
|
|
||||||
global_iviapp = g;
|
global_iviapp = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_iviapp && "no ivi_application found");
|
test_assert_ptr_not_null(global_iviapp);
|
||||||
|
|
||||||
assert(global_iviapp->version == 1);
|
test_assert_u32_eq(global_iviapp->version, 1);
|
||||||
|
|
||||||
iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name,
|
iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name,
|
||||||
&ivi_application_interface, 1);
|
&ivi_application_interface, 1);
|
||||||
assert(iviapp);
|
test_assert_ptr_not_null(iviapp);
|
||||||
|
|
||||||
return iviapp;
|
return iviapp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "ivi-application-client-protocol.h"
|
#include "ivi-application-client-protocol.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "test-config.h"
|
#include "test-config.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
|
|
@ -158,18 +159,19 @@ get_ivi_application(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_iviapp)
|
if (global_iviapp)
|
||||||
assert(0 && "multiple ivi_application objects");
|
test_assert_not_reached("multiple ivi_application objects");
|
||||||
|
|
||||||
global_iviapp = g;
|
global_iviapp = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_iviapp && "no ivi_application found");
|
/* No ivi_application found. */
|
||||||
|
test_assert_ptr_not_null(global_iviapp);
|
||||||
|
|
||||||
assert(global_iviapp->version == 1);
|
test_assert_int_eq(global_iviapp->version, 1);
|
||||||
|
|
||||||
iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name,
|
iviapp = wl_registry_bind(client->wl_registry, global_iviapp->name,
|
||||||
&ivi_application_interface, 1);
|
&ivi_application_interface, 1);
|
||||||
assert(iviapp);
|
test_assert_ptr_not_null(iviapp);
|
||||||
|
|
||||||
return iviapp;
|
return iviapp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include "shared/timespec-util.h"
|
#include "shared/timespec-util.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -53,7 +54,7 @@ static struct client *
|
||||||
create_client_with_keyboard_focus(void)
|
create_client_with_keyboard_focus(void)
|
||||||
{
|
{
|
||||||
struct client *cl = create_client_and_test_surface(10, 10, 1, 1);
|
struct client *cl = create_client_and_test_surface(10, 10, 1, 1);
|
||||||
assert(cl);
|
test_assert_ptr_not_null(cl);
|
||||||
|
|
||||||
weston_test_activate_surface(cl->test->weston_test,
|
weston_test_activate_surface(cl->test->weston_test,
|
||||||
cl->surface->wl_surface);
|
cl->surface->wl_surface);
|
||||||
|
|
@ -83,9 +84,9 @@ TEST(simple_keyboard_test)
|
||||||
uint32_t expect_state = 0;
|
uint32_t expect_state = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
assert(keyboard->key == expect_key);
|
test_assert_u32_eq(keyboard->key, expect_key);
|
||||||
assert(keyboard->state == expect_state);
|
test_assert_u32_eq(keyboard->state, expect_state);
|
||||||
assert(keyboard->focus == expect_focus);
|
test_assert_ptr_eq(keyboard->focus, expect_focus);
|
||||||
|
|
||||||
if (keyboard->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (keyboard->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
expect_state = WL_KEYBOARD_KEY_STATE_RELEASED;
|
expect_state = WL_KEYBOARD_KEY_STATE_RELEASED;
|
||||||
|
|
@ -119,12 +120,12 @@ TEST(keyboard_key_event_time)
|
||||||
input_timestamps_create_for_keyboard(client);
|
input_timestamps_create_for_keyboard(client);
|
||||||
|
|
||||||
send_key(client, &t1, 1, WL_KEYBOARD_KEY_STATE_PRESSED);
|
send_key(client, &t1, 1, WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||||
assert(keyboard->key_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(keyboard->key_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&keyboard->key_time_timespec, &t1));
|
test_assert_true(timespec_eq(&keyboard->key_time_timespec, &t1));
|
||||||
|
|
||||||
send_key(client, &t2, 1, WL_KEYBOARD_KEY_STATE_RELEASED);
|
send_key(client, &t2, 1, WL_KEYBOARD_KEY_STATE_RELEASED);
|
||||||
assert(keyboard->key_time_msec == timespec_to_msec(&t2));
|
test_assert_s64_eq(keyboard->key_time_msec, timespec_to_msec(&t2));
|
||||||
assert(timespec_eq(&keyboard->key_time_timespec, &t2));
|
test_assert_true(timespec_eq(&keyboard->key_time_timespec, &t2));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
|
|
@ -139,14 +140,14 @@ TEST(keyboard_timestamps_stop_after_input_timestamps_object_is_destroyed)
|
||||||
input_timestamps_create_for_keyboard(client);
|
input_timestamps_create_for_keyboard(client);
|
||||||
|
|
||||||
send_key(client, &t1, 1, WL_KEYBOARD_KEY_STATE_PRESSED);
|
send_key(client, &t1, 1, WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||||
assert(keyboard->key_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(keyboard->key_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&keyboard->key_time_timespec, &t1));
|
test_assert_true(timespec_eq(&keyboard->key_time_timespec, &t1));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
send_key(client, &t2, 1, WL_KEYBOARD_KEY_STATE_RELEASED);
|
send_key(client, &t2, 1, WL_KEYBOARD_KEY_STATE_RELEASED);
|
||||||
assert(keyboard->key_time_msec == timespec_to_msec(&t2));
|
test_assert_s64_eq(keyboard->key_time_msec, timespec_to_msec(&t2));
|
||||||
assert(timespec_is_zero(&keyboard->key_time_timespec));
|
test_assert_true(timespec_is_zero(&keyboard->key_time_timespec));
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
}
|
}
|
||||||
|
|
@ -159,8 +160,8 @@ TEST(keyboard_timestamps_stop_after_client_releases_wl_keyboard)
|
||||||
input_timestamps_create_for_keyboard(client);
|
input_timestamps_create_for_keyboard(client);
|
||||||
|
|
||||||
send_key(client, &t1, 1, WL_KEYBOARD_KEY_STATE_PRESSED);
|
send_key(client, &t1, 1, WL_KEYBOARD_KEY_STATE_PRESSED);
|
||||||
assert(keyboard->key_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(keyboard->key_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&keyboard->key_time_timespec, &t1));
|
test_assert_true(timespec_eq(&keyboard->key_time_timespec, &t1));
|
||||||
|
|
||||||
wl_keyboard_release(client->input->keyboard->wl_keyboard);
|
wl_keyboard_release(client->input->keyboard->wl_keyboard);
|
||||||
|
|
||||||
|
|
@ -171,7 +172,7 @@ TEST(keyboard_timestamps_stop_after_client_releases_wl_keyboard)
|
||||||
* event and checking for it here may lead to false negatives. */
|
* event and checking for it here may lead to false negatives. */
|
||||||
keyboard->input_timestamp = t_other;
|
keyboard->input_timestamp = t_other;
|
||||||
send_key(client, &t2, 1, WL_KEYBOARD_KEY_STATE_RELEASED);
|
send_key(client, &t2, 1, WL_KEYBOARD_KEY_STATE_RELEASED);
|
||||||
assert(timespec_eq(&keyboard->input_timestamp, &t_other));
|
test_assert_true(timespec_eq(&keyboard->input_timestamp, &t_other));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
#include "shared/xalloc.h"
|
#include "shared/xalloc.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "xdg-shell-client-protocol.h"
|
#include "xdg-shell-client-protocol.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
|
|
@ -179,9 +180,9 @@ create_xdg_surface(struct xdg_client *xdg_client)
|
||||||
{
|
{
|
||||||
struct xdg_surface_data *xdg_surface = xzalloc(sizeof(*xdg_surface));
|
struct xdg_surface_data *xdg_surface = xzalloc(sizeof(*xdg_surface));
|
||||||
|
|
||||||
assert(xdg_surface);
|
test_assert_ptr_not_null(xdg_surface);
|
||||||
xdg_surface->surface = create_test_surface(xdg_client->client);
|
xdg_surface->surface = create_test_surface(xdg_client->client);
|
||||||
assert(xdg_surface->surface);
|
test_assert_ptr_not_null(xdg_surface->surface);
|
||||||
|
|
||||||
xdg_surface->xdg_surface =
|
xdg_surface->xdg_surface =
|
||||||
xdg_wm_base_get_xdg_surface(xdg_client->xdg_wm_base,
|
xdg_wm_base_get_xdg_surface(xdg_client->xdg_wm_base,
|
||||||
|
|
@ -208,7 +209,7 @@ xdg_surface_make_toplevel(struct xdg_surface_data *xdg_surface,
|
||||||
{
|
{
|
||||||
xdg_surface->xdg_toplevel =
|
xdg_surface->xdg_toplevel =
|
||||||
xdg_surface_get_toplevel(xdg_surface->xdg_surface);
|
xdg_surface_get_toplevel(xdg_surface->xdg_surface);
|
||||||
assert(xdg_surface->xdg_toplevel);
|
test_assert_ptr_not_null(xdg_surface->xdg_toplevel);
|
||||||
xdg_toplevel_add_listener(xdg_surface->xdg_toplevel,
|
xdg_toplevel_add_listener(xdg_surface->xdg_toplevel,
|
||||||
&xdg_toplevel_listener, xdg_surface);
|
&xdg_toplevel_listener, xdg_surface);
|
||||||
xdg_toplevel_set_app_id(xdg_surface->xdg_toplevel, app_id);
|
xdg_toplevel_set_app_id(xdg_surface->xdg_toplevel, app_id);
|
||||||
|
|
@ -220,7 +221,7 @@ xdg_surface_wait_configure(struct xdg_surface_data *xdg_surface)
|
||||||
{
|
{
|
||||||
wl_surface_commit(xdg_surface->surface->wl_surface);
|
wl_surface_commit(xdg_surface->surface->wl_surface);
|
||||||
wl_display_roundtrip(xdg_surface->surface->client->wl_display);
|
wl_display_roundtrip(xdg_surface->surface->client->wl_display);
|
||||||
assert(xdg_surface->configure.serial > 0);
|
test_assert_u32_gt(xdg_surface->configure.serial, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -234,7 +235,7 @@ xdg_surface_commit_solid(struct xdg_surface_data *xdg_surface,
|
||||||
|
|
||||||
buf = create_shm_buffer_a8r8g8b8(xdg_surface->surface->client,
|
buf = create_shm_buffer_a8r8g8b8(xdg_surface->surface->client,
|
||||||
width, height);
|
width, height);
|
||||||
assert(buf);
|
test_assert_ptr_not_null(buf);
|
||||||
xdg_surface->surface->buffer = buf;
|
xdg_surface->surface->buffer = buf;
|
||||||
|
|
||||||
color_rgb888(&color, r, g, b);
|
color_rgb888(&color, r, g, b);
|
||||||
|
|
@ -261,14 +262,14 @@ create_xdg_client(void)
|
||||||
{
|
{
|
||||||
struct xdg_client *xdg_client = xzalloc(sizeof(*xdg_client));
|
struct xdg_client *xdg_client = xzalloc(sizeof(*xdg_client));
|
||||||
|
|
||||||
assert(xdg_client);
|
test_assert_ptr_not_null(xdg_client);
|
||||||
xdg_client->client = create_client();
|
xdg_client->client = create_client();
|
||||||
assert(xdg_client->client);
|
test_assert_ptr_not_null(xdg_client->client);
|
||||||
|
|
||||||
xdg_client->xdg_wm_base = bind_to_singleton_global(xdg_client->client,
|
xdg_client->xdg_wm_base = bind_to_singleton_global(xdg_client->client,
|
||||||
&xdg_wm_base_interface,
|
&xdg_wm_base_interface,
|
||||||
5);
|
5);
|
||||||
assert(xdg_client->xdg_wm_base);
|
test_assert_ptr_not_null(xdg_client->xdg_wm_base);
|
||||||
xdg_wm_base_add_listener(xdg_client->xdg_wm_base, &xdg_wm_base_listener,
|
xdg_wm_base_add_listener(xdg_client->xdg_wm_base, &xdg_wm_base_listener,
|
||||||
xdg_client);
|
xdg_client);
|
||||||
|
|
||||||
|
|
@ -300,23 +301,24 @@ DECLARE_LIST_ITERATOR(view_from_surface, struct weston_surface, views,
|
||||||
static void assert_resource_is_proxy(struct wet_testsuite_data *suite_data,
|
static void assert_resource_is_proxy(struct wet_testsuite_data *suite_data,
|
||||||
struct wl_resource *r, void *p)
|
struct wl_resource *r, void *p)
|
||||||
{
|
{
|
||||||
assert(r);
|
test_assert_ptr_not_null(r);
|
||||||
assert(wl_resource_get_client(r) == suite_data->wl_client);
|
test_assert_ptr_eq(wl_resource_get_client(r), suite_data->wl_client);
|
||||||
assert(wl_resource_get_id(r) == wl_proxy_get_id((struct wl_proxy *) p));
|
test_assert_u32_eq(wl_resource_get_id(r),
|
||||||
|
wl_proxy_get_id((struct wl_proxy *) p));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void assert_surface_matches(struct wet_testsuite_data *suite_data,
|
static void assert_surface_matches(struct wet_testsuite_data *suite_data,
|
||||||
struct weston_surface *s, struct surface *c)
|
struct weston_surface *s, struct surface *c)
|
||||||
{
|
{
|
||||||
assert(s);
|
test_assert_ptr_not_null(s);
|
||||||
assert(c);
|
test_assert_ptr_not_null(c);
|
||||||
|
|
||||||
assert_resource_is_proxy(suite_data, s->resource, c->wl_surface);
|
assert_resource_is_proxy(suite_data, s->resource, c->wl_surface);
|
||||||
assert(s->width == c->width);
|
test_assert_s32_eq(s->width, c->width);
|
||||||
assert(s->height == c->height);
|
test_assert_s32_eq(s->height, c->height);
|
||||||
|
|
||||||
assert(s->buffer_ref.buffer);
|
test_assert_ptr_not_null(s->buffer_ref.buffer);
|
||||||
assert(c->buffer);
|
test_assert_ptr_not_null(c->buffer);
|
||||||
assert_resource_is_proxy(suite_data, s->buffer_ref.buffer->resource,
|
assert_resource_is_proxy(suite_data, s->buffer_ref.buffer->resource,
|
||||||
c->buffer->proxy);
|
c->buffer->proxy);
|
||||||
}
|
}
|
||||||
|
|
@ -327,8 +329,8 @@ static void assert_output_matches(struct wet_testsuite_data *suite_data,
|
||||||
struct weston_head *head;
|
struct weston_head *head;
|
||||||
bool found_client_resource = false;
|
bool found_client_resource = false;
|
||||||
|
|
||||||
assert(s);
|
test_assert_ptr_not_null(s);
|
||||||
assert(c);
|
test_assert_ptr_not_null(c);
|
||||||
|
|
||||||
wl_list_for_each(head, &s->head_list, output_link) {
|
wl_list_for_each(head, &s->head_list, output_link) {
|
||||||
struct wl_resource *res;
|
struct wl_resource *res;
|
||||||
|
|
@ -341,10 +343,10 @@ static void assert_output_matches(struct wet_testsuite_data *suite_data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(found_client_resource);
|
test_assert_true(found_client_resource);
|
||||||
|
|
||||||
assert(s->width == c->width);
|
test_assert_s32_eq(s->width, c->width);
|
||||||
assert(s->height == c->height);
|
test_assert_s32_eq(s->height, c->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
|
@ -354,10 +356,10 @@ get_server_res_from_proxy(struct wet_testsuite_data *suite_data,
|
||||||
uint32_t id = wl_proxy_get_id((struct wl_proxy *) p);
|
uint32_t id = wl_proxy_get_id((struct wl_proxy *) p);
|
||||||
struct wl_resource *res;
|
struct wl_resource *res;
|
||||||
|
|
||||||
assert(p);
|
test_assert_ptr_not_null(p);
|
||||||
assert(id > 0);
|
test_assert_u32_gt(id, 0);
|
||||||
res = wl_client_get_object(suite_data->wl_client, id);
|
res = wl_client_get_object(suite_data->wl_client, id);
|
||||||
assert(res);
|
test_assert_ptr_not_null(res);
|
||||||
return wl_resource_get_user_data(res);
|
return wl_resource_get_user_data(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -367,15 +369,15 @@ assert_surface_is_background(struct wet_testsuite_data *suite_data,
|
||||||
{
|
{
|
||||||
char lbl[128];
|
char lbl[128];
|
||||||
|
|
||||||
assert(!surface->resource);
|
test_assert_ptr_null(surface->resource);
|
||||||
assert(surface->buffer_ref.buffer);
|
test_assert_ptr_not_null(surface->buffer_ref.buffer);
|
||||||
assert(surface->buffer_ref.buffer->type == WESTON_BUFFER_SOLID);
|
test_assert_enum(surface->buffer_ref.buffer->type, WESTON_BUFFER_SOLID);
|
||||||
assert(surface->output);
|
test_assert_ptr_not_null(surface->output);
|
||||||
assert(surface->width == surface->output->width);
|
test_assert_s32_eq(surface->width, surface->output->width);
|
||||||
assert(surface->height == surface->output->height);
|
test_assert_s32_eq(surface->height, surface->output->height);
|
||||||
assert(surface->get_label &&
|
test_assert_ptr_not_null(surface->get_label);
|
||||||
surface->get_label(surface, lbl, sizeof(lbl)) &&
|
test_assert_int_ne(surface->get_label(surface, lbl, sizeof(lbl)), 0);
|
||||||
strcmp(lbl, "kiosk shell background surface") == 0);
|
test_assert_str_eq(lbl, "kiosk shell background surface");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(two_surface_switching)
|
TEST(two_surface_switching)
|
||||||
|
|
@ -385,19 +387,21 @@ TEST(two_surface_switching)
|
||||||
struct xdg_surface_data *xdg_surface1, *xdg_surface2;
|
struct xdg_surface_data *xdg_surface1, *xdg_surface2;
|
||||||
struct input *input;
|
struct input *input;
|
||||||
|
|
||||||
assert(xdg_client);
|
test_assert_ptr_not_null(xdg_client);
|
||||||
|
|
||||||
/* move the pointer clearly away from our screenshooting area */
|
/* move the pointer clearly away from our screenshooting area */
|
||||||
weston_test_move_pointer(xdg_client->client->test->weston_test,
|
weston_test_move_pointer(xdg_client->client->test->weston_test,
|
||||||
0, 1, 0, 2, 30);
|
0, 1, 0, 2, 30);
|
||||||
|
|
||||||
xdg_surface1 = create_xdg_surface(xdg_client);
|
xdg_surface1 = create_xdg_surface(xdg_client);
|
||||||
assert(xdg_surface1);
|
test_assert_ptr_not_null(xdg_surface1);
|
||||||
xdg_surface_make_toplevel(xdg_surface1, "weston.test.kiosk", "one");
|
xdg_surface_make_toplevel(xdg_surface1, "weston.test.kiosk", "one");
|
||||||
xdg_surface_wait_configure(xdg_surface1);
|
xdg_surface_wait_configure(xdg_surface1);
|
||||||
assert(xdg_surface1->configure.fullscreen);
|
test_assert_true(xdg_surface1->configure.fullscreen);
|
||||||
assert(xdg_surface1->configure.width == xdg_client->client->output->width);
|
test_assert_int_eq(xdg_surface1->configure.width,
|
||||||
assert(xdg_surface1->configure.height == xdg_client->client->output->height);
|
xdg_client->client->output->width);
|
||||||
|
test_assert_int_eq(xdg_surface1->configure.height,
|
||||||
|
xdg_client->client->output->height);
|
||||||
|
|
||||||
client_push_breakpoint(xdg_client->client, suite_data,
|
client_push_breakpoint(xdg_client->client, suite_data,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT,
|
WESTON_TEST_BREAKPOINT_POST_REPAINT,
|
||||||
|
|
@ -416,37 +420,43 @@ TEST(two_surface_switching)
|
||||||
struct weston_desktop_surface *wds =
|
struct weston_desktop_surface *wds =
|
||||||
weston_surface_get_desktop_surface(surface);
|
weston_surface_get_desktop_surface(surface);
|
||||||
|
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
assert_output_matches(suite_data, output,
|
assert_output_matches(suite_data, output,
|
||||||
xdg_client->client->output);
|
xdg_client->client->output);
|
||||||
assert(pnode && surface && wds && view && buffer);
|
test_assert_ptr_not_null(pnode);
|
||||||
|
test_assert_ptr_not_null(surface);
|
||||||
|
test_assert_ptr_not_null(wds);
|
||||||
|
test_assert_ptr_not_null(view);
|
||||||
|
test_assert_ptr_not_null(buffer);
|
||||||
|
|
||||||
/* check that our surface is top of the paint node list */
|
/* check that our surface is top of the paint node list */
|
||||||
assert_surface_matches(suite_data, surface, xdg_surface1->surface);
|
assert_surface_matches(suite_data, surface, xdg_surface1->surface);
|
||||||
assert(strcmp(weston_desktop_surface_get_title(wds), "one") == 0);
|
test_assert_str_eq(weston_desktop_surface_get_title(wds), "one");
|
||||||
assert(weston_view_is_mapped(view));
|
test_assert_true(weston_view_is_mapped(view));
|
||||||
assert(weston_surface_is_mapped(surface));
|
test_assert_true(weston_surface_is_mapped(surface));
|
||||||
|
|
||||||
/* the background should be under that */
|
/* the background should be under that */
|
||||||
pnode = next_pnode_from_z(output, pnode);
|
pnode = next_pnode_from_z(output, pnode);
|
||||||
assert(pnode);
|
test_assert_ptr_not_null(pnode);
|
||||||
assert_surface_is_background(suite_data, pnode->view->surface);
|
assert_surface_is_background(suite_data, pnode->view->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_display_roundtrip(xdg_client->client->wl_display);
|
wl_display_roundtrip(xdg_client->client->wl_display);
|
||||||
input = container_of(xdg_client->client->inputs.next, struct input, link);
|
input = container_of(xdg_client->client->inputs.next, struct input, link);
|
||||||
assert(input);
|
test_assert_ptr_not_null(input);
|
||||||
assert(input->keyboard);
|
test_assert_ptr_not_null(input->keyboard);
|
||||||
assert(input->keyboard->focus == xdg_surface1->surface);
|
test_assert_ptr_eq(input->keyboard->focus, xdg_surface1->surface);
|
||||||
|
|
||||||
xdg_surface2 = create_xdg_surface(xdg_client);
|
xdg_surface2 = create_xdg_surface(xdg_client);
|
||||||
assert(xdg_surface2);
|
test_assert_ptr_not_null(xdg_surface2);
|
||||||
xdg_surface_make_toplevel(xdg_surface2, "weston.test.kiosk", "two");
|
xdg_surface_make_toplevel(xdg_surface2, "weston.test.kiosk", "two");
|
||||||
xdg_surface_wait_configure(xdg_surface2);
|
xdg_surface_wait_configure(xdg_surface2);
|
||||||
assert(xdg_surface2->configure.fullscreen);
|
test_assert_true(xdg_surface2->configure.fullscreen);
|
||||||
assert(xdg_surface2->configure.width == xdg_client->client->output->width);
|
test_assert_int_eq(xdg_surface2->configure.width,
|
||||||
assert(xdg_surface2->configure.height == xdg_client->client->output->height);
|
xdg_client->client->output->width);
|
||||||
|
test_assert_int_eq(xdg_surface2->configure.height,
|
||||||
|
xdg_client->client->output->height);
|
||||||
|
|
||||||
client_push_breakpoint(xdg_client->client, suite_data,
|
client_push_breakpoint(xdg_client->client, suite_data,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT,
|
WESTON_TEST_BREAKPOINT_POST_REPAINT,
|
||||||
|
|
@ -465,26 +475,30 @@ TEST(two_surface_switching)
|
||||||
struct weston_desktop_surface *wds =
|
struct weston_desktop_surface *wds =
|
||||||
weston_surface_get_desktop_surface(surface);
|
weston_surface_get_desktop_surface(surface);
|
||||||
|
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
assert_output_matches(suite_data, output,
|
assert_output_matches(suite_data, output,
|
||||||
xdg_client->client->output);
|
xdg_client->client->output);
|
||||||
assert(pnode && surface && wds && view && buffer);
|
test_assert_ptr_not_null(pnode);
|
||||||
|
test_assert_ptr_not_null(surface);
|
||||||
|
test_assert_ptr_not_null(wds);
|
||||||
|
test_assert_ptr_not_null(view);
|
||||||
|
test_assert_ptr_not_null(buffer);
|
||||||
|
|
||||||
/* check that our surface is top of the paint node list */
|
/* check that our surface is top of the paint node list */
|
||||||
assert_surface_matches(suite_data, surface, xdg_surface2->surface);
|
assert_surface_matches(suite_data, surface, xdg_surface2->surface);
|
||||||
assert(strcmp(weston_desktop_surface_get_title(wds), "two") == 0);
|
test_assert_str_eq(weston_desktop_surface_get_title(wds), "two");
|
||||||
assert(weston_surface_is_mapped(surface));
|
test_assert_true(weston_surface_is_mapped(surface));
|
||||||
assert(weston_view_is_mapped(view));
|
test_assert_true(weston_view_is_mapped(view));
|
||||||
|
|
||||||
/* the background should be under that */
|
/* the background should be under that */
|
||||||
pnode = next_pnode_from_z(output, pnode);
|
pnode = next_pnode_from_z(output, pnode);
|
||||||
assert(pnode);
|
test_assert_ptr_not_null(pnode);
|
||||||
assert_surface_is_background(suite_data, pnode->view->surface);
|
assert_surface_is_background(suite_data, pnode->view->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_display_roundtrip(xdg_client->client->wl_display);
|
wl_display_roundtrip(xdg_client->client->wl_display);
|
||||||
assert(input->keyboard->focus == xdg_surface2->surface);
|
test_assert_ptr_eq(input->keyboard->focus, xdg_surface2->surface);
|
||||||
destroy_xdg_surface(xdg_surface2);
|
destroy_xdg_surface(xdg_surface2);
|
||||||
|
|
||||||
client_push_breakpoint(xdg_client->client, suite_data,
|
client_push_breakpoint(xdg_client->client, suite_data,
|
||||||
|
|
@ -502,22 +516,26 @@ TEST(two_surface_switching)
|
||||||
struct weston_desktop_surface *wds =
|
struct weston_desktop_surface *wds =
|
||||||
weston_surface_get_desktop_surface(surface);
|
weston_surface_get_desktop_surface(surface);
|
||||||
|
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
assert_output_matches(suite_data, output,
|
assert_output_matches(suite_data, output,
|
||||||
xdg_client->client->output);
|
xdg_client->client->output);
|
||||||
assert(pnode && surface && wds && view && buffer);
|
test_assert_ptr_not_null(pnode);
|
||||||
|
test_assert_ptr_not_null(surface);
|
||||||
|
test_assert_ptr_not_null(wds);
|
||||||
|
test_assert_ptr_not_null(view);
|
||||||
|
test_assert_ptr_not_null(buffer);
|
||||||
|
|
||||||
/* check that our surface is top of the paint node list */
|
/* check that our surface is top of the paint node list */
|
||||||
assert_surface_matches(suite_data, surface, xdg_surface1->surface);
|
assert_surface_matches(suite_data, surface, xdg_surface1->surface);
|
||||||
assert(surface->resource);
|
test_assert_ptr_not_null(surface->resource);
|
||||||
assert(weston_view_is_mapped(view));
|
test_assert_true(weston_view_is_mapped(view));
|
||||||
assert(weston_surface_is_mapped(surface));
|
test_assert_true(weston_surface_is_mapped(surface));
|
||||||
assert(strcmp(weston_desktop_surface_get_title(wds), "one") == 0);
|
test_assert_str_eq(weston_desktop_surface_get_title(wds), "one");
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_display_roundtrip(xdg_client->client->wl_display);
|
wl_display_roundtrip(xdg_client->client->wl_display);
|
||||||
assert(input->keyboard->focus == xdg_surface1->surface);
|
test_assert_ptr_eq(input->keyboard->focus, xdg_surface1->surface);
|
||||||
|
|
||||||
destroy_xdg_surface(xdg_surface1);
|
destroy_xdg_surface(xdg_surface1);
|
||||||
xdg_client_destroy(xdg_client);
|
xdg_client_destroy(xdg_client);
|
||||||
|
|
@ -530,8 +548,8 @@ TEST(top_surface_present_in_output_repaint)
|
||||||
struct xdg_client *xdg_client = create_xdg_client();
|
struct xdg_client *xdg_client = create_xdg_client();
|
||||||
struct xdg_surface_data *xdg_surface = create_xdg_surface(xdg_client);
|
struct xdg_surface_data *xdg_surface = create_xdg_surface(xdg_client);
|
||||||
|
|
||||||
assert(xdg_client);
|
test_assert_ptr_not_null(xdg_client);
|
||||||
assert(xdg_surface);
|
test_assert_ptr_not_null(xdg_surface);
|
||||||
|
|
||||||
/* move the pointer clearly away from our screenshooting area */
|
/* move the pointer clearly away from our screenshooting area */
|
||||||
weston_test_move_pointer(xdg_client->client->test->weston_test,
|
weston_test_move_pointer(xdg_client->client->test->weston_test,
|
||||||
|
|
@ -539,9 +557,11 @@ TEST(top_surface_present_in_output_repaint)
|
||||||
|
|
||||||
xdg_surface_make_toplevel(xdg_surface, "weston.test.kiosk", "one");
|
xdg_surface_make_toplevel(xdg_surface, "weston.test.kiosk", "one");
|
||||||
xdg_surface_wait_configure(xdg_surface);
|
xdg_surface_wait_configure(xdg_surface);
|
||||||
assert(xdg_surface->configure.fullscreen);
|
test_assert_true(xdg_surface->configure.fullscreen);
|
||||||
assert(xdg_surface->configure.width == xdg_client->client->output->width);
|
test_assert_int_eq(xdg_surface->configure.width,
|
||||||
assert(xdg_surface->configure.height == xdg_client->client->output->height);
|
xdg_client->client->output->width);
|
||||||
|
test_assert_int_eq(xdg_surface->configure.height,
|
||||||
|
xdg_client->client->output->height);
|
||||||
|
|
||||||
client_push_breakpoint(xdg_client->client, suite_data,
|
client_push_breakpoint(xdg_client->client, suite_data,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT,
|
WESTON_TEST_BREAKPOINT_POST_REPAINT,
|
||||||
|
|
@ -558,15 +578,18 @@ TEST(top_surface_present_in_output_repaint)
|
||||||
struct weston_surface *surface = view->surface;
|
struct weston_surface *surface = view->surface;
|
||||||
struct weston_buffer *buffer = surface->buffer_ref.buffer;
|
struct weston_buffer *buffer = surface->buffer_ref.buffer;
|
||||||
|
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
assert_output_matches(suite_data, output, xdg_client->client->output);
|
assert_output_matches(suite_data, output, xdg_client->client->output);
|
||||||
assert(pnode && surface && view && buffer);
|
test_assert_ptr_not_null(pnode);
|
||||||
|
test_assert_ptr_not_null(surface);
|
||||||
|
test_assert_ptr_not_null(view);
|
||||||
|
test_assert_ptr_not_null(buffer);
|
||||||
|
|
||||||
/* check that our surface is top of the paint node list */
|
/* check that our surface is top of the paint node list */
|
||||||
assert_surface_matches(suite_data, surface, xdg_surface->surface);
|
assert_surface_matches(suite_data, surface, xdg_surface->surface);
|
||||||
assert(weston_view_is_mapped(view));
|
test_assert_true(weston_view_is_mapped(view));
|
||||||
assert(weston_surface_is_mapped(surface));
|
test_assert_true(weston_surface_is_mapped(surface));
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy_xdg_surface(xdg_surface);
|
destroy_xdg_surface(xdg_surface);
|
||||||
|
|
@ -579,8 +602,8 @@ TEST(test_surface_unmaps_on_null)
|
||||||
struct xdg_client *xdg_client = create_xdg_client();
|
struct xdg_client *xdg_client = create_xdg_client();
|
||||||
struct xdg_surface_data *xdg_surface = create_xdg_surface(xdg_client);;
|
struct xdg_surface_data *xdg_surface = create_xdg_surface(xdg_client);;
|
||||||
|
|
||||||
assert(xdg_client);
|
test_assert_ptr_not_null(xdg_client);
|
||||||
assert(xdg_surface);
|
test_assert_ptr_not_null(xdg_surface);
|
||||||
|
|
||||||
/* move the pointer clearly away from our screenshooting area */
|
/* move the pointer clearly away from our screenshooting area */
|
||||||
weston_test_move_pointer(xdg_client->client->test->weston_test,
|
weston_test_move_pointer(xdg_client->client->test->weston_test,
|
||||||
|
|
@ -588,9 +611,11 @@ TEST(test_surface_unmaps_on_null)
|
||||||
|
|
||||||
xdg_surface_make_toplevel(xdg_surface, "weston.test.kiosk", "one");
|
xdg_surface_make_toplevel(xdg_surface, "weston.test.kiosk", "one");
|
||||||
xdg_surface_wait_configure(xdg_surface);
|
xdg_surface_wait_configure(xdg_surface);
|
||||||
assert(xdg_surface->configure.fullscreen);
|
test_assert_true(xdg_surface->configure.fullscreen);
|
||||||
assert(xdg_surface->configure.width == xdg_client->client->output->width);
|
test_assert_int_eq(xdg_surface->configure.width,
|
||||||
assert(xdg_surface->configure.height == xdg_client->client->output->height);
|
xdg_client->client->output->width);
|
||||||
|
test_assert_int_eq(xdg_surface->configure.height,
|
||||||
|
xdg_client->client->output->height);
|
||||||
|
|
||||||
client_push_breakpoint(xdg_client->client, suite_data,
|
client_push_breakpoint(xdg_client->client, suite_data,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT,
|
WESTON_TEST_BREAKPOINT_POST_REPAINT,
|
||||||
|
|
@ -607,14 +632,16 @@ TEST(test_surface_unmaps_on_null)
|
||||||
struct weston_surface *surface = view->surface;
|
struct weston_surface *surface = view->surface;
|
||||||
|
|
||||||
/* Check that our surface is being shown on top */
|
/* Check that our surface is being shown on top */
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
assert(pnode && surface && view);
|
test_assert_ptr_not_null(pnode);
|
||||||
|
test_assert_ptr_not_null(surface);
|
||||||
|
test_assert_ptr_not_null(view);
|
||||||
assert_surface_matches(suite_data, surface, xdg_surface->surface);
|
assert_surface_matches(suite_data, surface, xdg_surface->surface);
|
||||||
assert_output_matches(suite_data, surface->output,
|
assert_output_matches(suite_data, surface->output,
|
||||||
xdg_client->client->output);
|
xdg_client->client->output);
|
||||||
assert(weston_view_is_mapped(view));
|
test_assert_true(weston_view_is_mapped(view));
|
||||||
assert(weston_surface_is_mapped(surface));
|
test_assert_true(weston_surface_is_mapped(surface));
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_surface_attach(xdg_surface->surface->wl_surface, NULL, 0, 0);
|
wl_surface_attach(xdg_surface->surface->wl_surface, NULL, 0, 0);
|
||||||
|
|
@ -633,23 +660,26 @@ TEST(test_surface_unmaps_on_null)
|
||||||
struct weston_surface *surface = view->surface;
|
struct weston_surface *surface = view->surface;
|
||||||
struct weston_buffer *buffer = surface->buffer_ref.buffer;
|
struct weston_buffer *buffer = surface->buffer_ref.buffer;
|
||||||
|
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
|
|
||||||
/* Check that the background is being shown on top. */
|
/* Check that the background is being shown on top. */
|
||||||
assert(pnode && surface && view && buffer);
|
test_assert_ptr_not_null(pnode);
|
||||||
|
test_assert_ptr_not_null(surface);
|
||||||
|
test_assert_ptr_not_null(view);
|
||||||
|
test_assert_ptr_not_null(buffer);
|
||||||
assert_surface_is_background(suite_data, surface);
|
assert_surface_is_background(suite_data, surface);
|
||||||
|
|
||||||
/* Check that kiosk-shell's view of our surface has been
|
/* Check that kiosk-shell's view of our surface has been
|
||||||
* unmapped, and that there aren't any more views. */
|
* unmapped, and that there aren't any more views. */
|
||||||
surface = get_server_res_from_proxy(suite_data,
|
surface = get_server_res_from_proxy(suite_data,
|
||||||
xdg_surface->surface->wl_surface);
|
xdg_surface->surface->wl_surface);
|
||||||
assert(!weston_surface_is_mapped(surface));
|
test_assert_false(weston_surface_is_mapped(surface));
|
||||||
assert(!surface->buffer_ref.buffer);
|
test_assert_ptr_null(surface->buffer_ref.buffer);
|
||||||
assert(!surface->output);
|
test_assert_ptr_null(surface->output);
|
||||||
view = next_view_from_surface(surface, NULL);
|
view = next_view_from_surface(surface, NULL);
|
||||||
assert(!weston_view_is_mapped(view));
|
test_assert_false(weston_view_is_mapped(view));
|
||||||
assert(!next_view_from_surface(surface, view));
|
test_assert_ptr_null(next_view_from_surface(surface, view));
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy_xdg_surface(xdg_surface);
|
destroy_xdg_surface(xdg_surface);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include <lcms2.h>
|
#include <lcms2.h>
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "color_util.h"
|
#include "color_util.h"
|
||||||
#include "lcms_util.h"
|
#include "lcms_util.h"
|
||||||
|
|
||||||
|
|
@ -78,8 +79,8 @@ TEST_P(build_MPE_curves, build_MPE_curves_test_set)
|
||||||
testlog("Transfer function %s as a segmented curve element, error:\n",
|
testlog("Transfer function %s as a segmented curve element, error:\n",
|
||||||
transfer_fn_name(*fn));
|
transfer_fn_name(*fn));
|
||||||
scalar_stat_print_float(&stat);
|
scalar_stat_print_float(&stat);
|
||||||
assert(fabs(stat.max) < 1e-7);
|
test_assert_f64_lt(fabs(stat.max), 1e-7);
|
||||||
assert(fabs(stat.min) < 1e-7);
|
test_assert_f64_lt(fabs(stat.min), 1e-7);
|
||||||
|
|
||||||
cmsPipelineFree(pipeline);
|
cmsPipelineFree(pipeline);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <lcms2.h>
|
#include <lcms2.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <libweston/matrix.h>
|
#include <libweston/matrix.h>
|
||||||
#include "shared/helpers.h"
|
#include "shared/helpers.h"
|
||||||
#include "color_util.h"
|
#include "color_util.h"
|
||||||
#include "lcms_util.h"
|
#include "lcms_util.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static const cmsCIExyY wp_d65 = { 0.31271, 0.32902, 1.0 };
|
static const cmsCIExyY wp_d65 = { 0.31271, 0.32902, 1.0 };
|
||||||
|
|
||||||
|
|
@ -184,7 +184,7 @@ build_MPE_curve(cmsContext ctx, enum transfer_fn fn)
|
||||||
case TRANSFER_FN_SRGB_EOTF_INVERSE:
|
case TRANSFER_FN_SRGB_EOTF_INVERSE:
|
||||||
return build_MPE_curve_sRGB_inv(ctx);
|
return build_MPE_curve_sRGB_inv(ctx);
|
||||||
default:
|
default:
|
||||||
assert(0 && "unimplemented MPE curve");
|
test_assert_not_reached("unimplemented MPE curve");
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -199,7 +199,7 @@ build_MPE_curve_stage(cmsContext context_id, enum transfer_fn fn)
|
||||||
c = build_MPE_curve(context_id, fn);
|
c = build_MPE_curve(context_id, fn);
|
||||||
stage = cmsStageAllocToneCurves(context_id, 3,
|
stage = cmsStageAllocToneCurves(context_id, 3,
|
||||||
(cmsToneCurve *[3]){ c, c, c });
|
(cmsToneCurve *[3]){ c, c, c });
|
||||||
assert(stage);
|
test_assert_ptr_not_null(stage);
|
||||||
cmsFreeToneCurve(c);
|
cmsFreeToneCurve(c);
|
||||||
|
|
||||||
return stage;
|
return stage;
|
||||||
|
|
@ -278,7 +278,7 @@ roundtrip_verification(cmsPipeline *DToB, cmsPipeline *BToD, float tolerance)
|
||||||
cmsPipelineFree(pip);
|
cmsPipelineFree(pip);
|
||||||
|
|
||||||
rgb_diff_stat_print(&stat, "DToB->BToD roundtrip", 8);
|
rgb_diff_stat_print(&stat, "DToB->BToD roundtrip", 8);
|
||||||
assert(stat.two_norm.max < tolerance);
|
test_assert_f32_lt(stat.two_norm.max, tolerance);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct weston_vector ZEROS = {
|
static const struct weston_vector ZEROS = {
|
||||||
|
|
@ -377,7 +377,7 @@ create_cLUT_from_transform(cmsContext context_id, const cmsHTRANSFORM t,
|
||||||
struct transform_sampler_context tsc;
|
struct transform_sampler_context tsc;
|
||||||
cmsStage *cLUT_stage;
|
cmsStage *cLUT_stage;
|
||||||
|
|
||||||
assert(dim_size);
|
test_assert_int_ne(dim_size, 0);
|
||||||
|
|
||||||
tsc.t = t;
|
tsc.t = t;
|
||||||
tsc.dir = dir;
|
tsc.dir = dir;
|
||||||
|
|
@ -412,7 +412,7 @@ vcgt_tag_add_to_profile(cmsContext context_id, cmsHPROFILE profile,
|
||||||
for (i = 0; i < COLOR_CHAN_NUM; i++)
|
for (i = 0; i < COLOR_CHAN_NUM; i++)
|
||||||
vcgt_tag_curves[i] = cmsBuildGamma(context_id, vcgt_exponents[i]);
|
vcgt_tag_curves[i] = cmsBuildGamma(context_id, vcgt_exponents[i]);
|
||||||
|
|
||||||
assert(cmsWriteTag(profile, cmsSigVcgtTag, vcgt_tag_curves));
|
test_assert_true(cmsWriteTag(profile, cmsSigVcgtTag, vcgt_tag_curves));
|
||||||
|
|
||||||
cmsFreeToneCurveTriple(vcgt_tag_curves);
|
cmsFreeToneCurveTriple(vcgt_tag_curves);
|
||||||
}
|
}
|
||||||
|
|
@ -443,7 +443,7 @@ build_lcms_clut_profile_output(cmsContext context_id,
|
||||||
linear_device = cmsCreateRGBProfileTHR(context_id, &wp_d65,
|
linear_device = cmsCreateRGBProfileTHR(context_id, &wp_d65,
|
||||||
&pipeline->prim_output,
|
&pipeline->prim_output,
|
||||||
identity_curves);
|
identity_curves);
|
||||||
assert(cmsIsMatrixShaper(linear_device));
|
test_assert_true(cmsIsMatrixShaper(linear_device));
|
||||||
cmsFreeToneCurve(identity_curves[0]);
|
cmsFreeToneCurve(identity_curves[0]);
|
||||||
|
|
||||||
pcs = cmsCreateXYZProfileTHR(context_id);
|
pcs = cmsCreateXYZProfileTHR(context_id);
|
||||||
|
|
@ -551,8 +551,8 @@ build_lcms_matrix_shaper_profile_output(cmsContext context_id,
|
||||||
int type_inverse_tone_curve;
|
int type_inverse_tone_curve;
|
||||||
double inverse_tone_curve_param[5];
|
double inverse_tone_curve_param[5];
|
||||||
|
|
||||||
assert(find_tone_curve_type(pipeline->post_fn, &type_inverse_tone_curve,
|
test_assert_true(find_tone_curve_type(pipeline->post_fn, &type_inverse_tone_curve,
|
||||||
inverse_tone_curve_param));
|
inverse_tone_curve_param));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We are creating output profile and therefore we can use the following:
|
* We are creating output profile and therefore we can use the following:
|
||||||
|
|
@ -569,10 +569,10 @@ build_lcms_matrix_shaper_profile_output(cmsContext context_id,
|
||||||
(-1) * type_inverse_tone_curve,
|
(-1) * type_inverse_tone_curve,
|
||||||
inverse_tone_curve_param);
|
inverse_tone_curve_param);
|
||||||
|
|
||||||
assert(arr_curves[0]);
|
test_assert_ptr_not_null(arr_curves[0]);
|
||||||
hRGB = cmsCreateRGBProfileTHR(context_id, &wp_d65,
|
hRGB = cmsCreateRGBProfileTHR(context_id, &wp_d65,
|
||||||
&pipeline->prim_output, arr_curves);
|
&pipeline->prim_output, arr_curves);
|
||||||
assert(hRGB);
|
test_assert_ptr_not_null(hRGB);
|
||||||
|
|
||||||
vcgt_tag_add_to_profile(context_id, hRGB, vcgt_exponents);
|
vcgt_tag_add_to_profile(context_id, hRGB, vcgt_exponents);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "wayland-server-protocol.h"
|
#include "wayland-server-protocol.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -65,18 +66,18 @@ get_linux_explicit_synchronization(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_sync)
|
if (global_sync)
|
||||||
assert(!"Multiple linux explicit sync objects");
|
test_assert_not_reached("Multiple linux explicit sync objects");
|
||||||
|
|
||||||
global_sync = g;
|
global_sync = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_sync);
|
test_assert_ptr_not_null(global_sync);
|
||||||
assert(global_sync->version == 2);
|
test_assert_u32_eq(global_sync->version, 2);
|
||||||
|
|
||||||
sync = wl_registry_bind(
|
sync = wl_registry_bind(
|
||||||
client->wl_registry, global_sync->name,
|
client->wl_registry, global_sync->name,
|
||||||
&zwp_linux_explicit_synchronization_v1_interface, 2);
|
&zwp_linux_explicit_synchronization_v1_interface, 2);
|
||||||
assert(sync);
|
test_assert_ptr_not_null(sync);
|
||||||
|
|
||||||
return sync;
|
return sync;
|
||||||
}
|
}
|
||||||
|
|
@ -85,7 +86,7 @@ static struct client *
|
||||||
create_test_client(void)
|
create_test_client(void)
|
||||||
{
|
{
|
||||||
struct client *cl = create_client_and_test_surface(0, 0, 100, 100);
|
struct client *cl = create_client_and_test_surface(0, 0, 100, 100);
|
||||||
assert(cl);
|
test_assert_ptr_not_null(cl);
|
||||||
return cl;
|
return cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +128,7 @@ TEST(set_acquire_fence_with_invalid_fence_raises_error)
|
||||||
sync, client->surface->wl_surface);
|
sync, client->surface->wl_surface);
|
||||||
int pipefd[2] = { -1, -1 };
|
int pipefd[2] = { -1, -1 };
|
||||||
|
|
||||||
assert(pipe(pipefd) == 0);
|
test_assert_int_eq(pipe(pipefd), 0);
|
||||||
|
|
||||||
zwp_linux_surface_synchronization_v1_set_acquire_fence(surface_sync,
|
zwp_linux_surface_synchronization_v1_set_acquire_fence(surface_sync,
|
||||||
pipefd[0]);
|
pipefd[0]);
|
||||||
|
|
@ -153,7 +154,7 @@ TEST(set_acquire_fence_on_destroyed_surface_raises_error)
|
||||||
sync, client->surface->wl_surface);
|
sync, client->surface->wl_surface);
|
||||||
int pipefd[2] = { -1, -1 };
|
int pipefd[2] = { -1, -1 };
|
||||||
|
|
||||||
assert(pipe(pipefd) == 0);
|
test_assert_int_eq(pipe(pipefd), 0);
|
||||||
|
|
||||||
wl_surface_destroy(client->surface->wl_surface);
|
wl_surface_destroy(client->surface->wl_surface);
|
||||||
client->surface->wl_surface = NULL;
|
client->surface->wl_surface = NULL;
|
||||||
|
|
@ -288,7 +289,7 @@ buffer_release_fenced_handler(void *data,
|
||||||
struct zwp_linux_buffer_release_v1 *buffer_release,
|
struct zwp_linux_buffer_release_v1 *buffer_release,
|
||||||
int32_t fence)
|
int32_t fence)
|
||||||
{
|
{
|
||||||
assert(!"Fenced release not supported yet");
|
test_assert_not_reached("Fenced release not supported yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -340,7 +341,7 @@ TEST(get_release_events_are_emitted_for_different_buffers)
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
/* No release event should have been emitted yet (we are using the
|
/* No release event should have been emitted yet (we are using the
|
||||||
* pixman renderer, which holds buffers until they are replaced). */
|
* pixman renderer, which holds buffers until they are replaced). */
|
||||||
assert(buf_released1 == 0);
|
test_assert_int_eq(buf_released1, 0);
|
||||||
|
|
||||||
buffer_release2 =
|
buffer_release2 =
|
||||||
zwp_linux_surface_synchronization_v1_get_release(surface_sync);
|
zwp_linux_surface_synchronization_v1_get_release(surface_sync);
|
||||||
|
|
@ -353,8 +354,8 @@ TEST(get_release_events_are_emitted_for_different_buffers)
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
/* Check that exactly one buffer_release event was emitted for the
|
/* Check that exactly one buffer_release event was emitted for the
|
||||||
* previous commit (buf1). */
|
* previous commit (buf1). */
|
||||||
assert(buf_released1 == 1);
|
test_assert_int_eq(buf_released1, 1);
|
||||||
assert(buf_released2 == 0);
|
test_assert_int_eq(buf_released2, 0);
|
||||||
|
|
||||||
wl_surface_attach(surface, buf1->proxy, 0, 0);
|
wl_surface_attach(surface, buf1->proxy, 0, 0);
|
||||||
frame_callback_set(surface, &frame);
|
frame_callback_set(surface, &frame);
|
||||||
|
|
@ -362,8 +363,8 @@ TEST(get_release_events_are_emitted_for_different_buffers)
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
/* Check that exactly one buffer_release event was emitted for the
|
/* Check that exactly one buffer_release event was emitted for the
|
||||||
* previous commit (buf2). */
|
* previous commit (buf2). */
|
||||||
assert(buf_released1 == 1);
|
test_assert_int_eq(buf_released1, 1);
|
||||||
assert(buf_released2 == 1);
|
test_assert_int_eq(buf_released2, 1);
|
||||||
|
|
||||||
buffer_destroy(buf2);
|
buffer_destroy(buf2);
|
||||||
buffer_destroy(buf1);
|
buffer_destroy(buf1);
|
||||||
|
|
@ -401,7 +402,7 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_surface)
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
/* No release event should have been emitted yet (we are using the
|
/* No release event should have been emitted yet (we are using the
|
||||||
* pixman renderer, which holds buffers until they are replaced). */
|
* pixman renderer, which holds buffers until they are replaced). */
|
||||||
assert(buf_released1 == 0);
|
test_assert_int_eq(buf_released1, 0);
|
||||||
|
|
||||||
buffer_release2 =
|
buffer_release2 =
|
||||||
zwp_linux_surface_synchronization_v1_get_release(surface_sync);
|
zwp_linux_surface_synchronization_v1_get_release(surface_sync);
|
||||||
|
|
@ -414,8 +415,8 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_surface)
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
/* Check that exactly one buffer_release event was emitted for the
|
/* Check that exactly one buffer_release event was emitted for the
|
||||||
* previous commit (buf). */
|
* previous commit (buf). */
|
||||||
assert(buf_released1 == 1);
|
test_assert_int_eq(buf_released1, 1);
|
||||||
assert(buf_released2 == 0);
|
test_assert_int_eq(buf_released2, 0);
|
||||||
|
|
||||||
wl_surface_attach(surface, buf->proxy, 0, 0);
|
wl_surface_attach(surface, buf->proxy, 0, 0);
|
||||||
frame_callback_set(surface, &frame);
|
frame_callback_set(surface, &frame);
|
||||||
|
|
@ -423,8 +424,8 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_surface)
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
/* Check that exactly one buffer_release event was emitted for the
|
/* Check that exactly one buffer_release event was emitted for the
|
||||||
* previous commit (buf again). */
|
* previous commit (buf again). */
|
||||||
assert(buf_released1 == 1);
|
test_assert_int_eq(buf_released1, 1);
|
||||||
assert(buf_released2 == 1);
|
test_assert_int_eq(buf_released2, 1);
|
||||||
|
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
zwp_linux_buffer_release_v1_destroy(buffer_release2);
|
zwp_linux_buffer_release_v1_destroy(buffer_release2);
|
||||||
|
|
@ -479,8 +480,8 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_different_surfaces)
|
||||||
wl_surface_commit(surface2);
|
wl_surface_commit(surface2);
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
|
|
||||||
assert(buf_released1 == 0);
|
test_assert_int_eq(buf_released1, 0);
|
||||||
assert(buf_released2 == 0);
|
test_assert_int_eq(buf_released2, 0);
|
||||||
|
|
||||||
/* Attach buf2 to surface1, and check that a buffer_release event for
|
/* Attach buf2 to surface1, and check that a buffer_release event for
|
||||||
* the previous commit (buf1) for that surface is emitted. */
|
* the previous commit (buf1) for that surface is emitted. */
|
||||||
|
|
@ -489,8 +490,8 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_different_surfaces)
|
||||||
wl_surface_commit(surface1);
|
wl_surface_commit(surface1);
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
|
|
||||||
assert(buf_released1 == 1);
|
test_assert_int_eq(buf_released1, 1);
|
||||||
assert(buf_released2 == 0);
|
test_assert_int_eq(buf_released2, 0);
|
||||||
|
|
||||||
/* Attach buf2 to surface2, and check that a buffer_release event for
|
/* Attach buf2 to surface2, and check that a buffer_release event for
|
||||||
* the previous commit (buf1) for that surface is emitted. */
|
* the previous commit (buf1) for that surface is emitted. */
|
||||||
|
|
@ -499,8 +500,8 @@ TEST(get_release_events_are_emitted_for_same_buffer_on_different_surfaces)
|
||||||
wl_surface_commit(surface2);
|
wl_surface_commit(surface2);
|
||||||
frame_callback_wait(client, &frame);
|
frame_callback_wait(client, &frame);
|
||||||
|
|
||||||
assert(buf_released1 == 1);
|
test_assert_int_eq(buf_released1, 1);
|
||||||
assert(buf_released2 == 1);
|
test_assert_int_eq(buf_released2, 1);
|
||||||
|
|
||||||
buffer_destroy(buf2);
|
buffer_destroy(buf2);
|
||||||
buffer_destroy(buf1);
|
buffer_destroy(buf1);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <libweston/matrix.h>
|
#include <libweston/matrix.h>
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A helper to lay out a matrix in the natural writing order in code
|
* A helper to lay out a matrix in the natural writing order in code
|
||||||
|
|
@ -266,6 +267,6 @@ TEST_P(matrix_inversion_precision, matrices)
|
||||||
if (err > tm->err_limit) {
|
if (err > tm->err_limit) {
|
||||||
testlog("Error is too high for matrix\n");
|
testlog("Error is too high for matrix\n");
|
||||||
print_matrix(&tm->M);
|
print_matrix(&tm->M);
|
||||||
assert(0);
|
test_assert_true(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
@ -37,15 +36,16 @@
|
||||||
#include "libweston/matrix.h"
|
#include "libweston/matrix.h"
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
transform_expect(struct weston_matrix *a, bool valid, enum wl_output_transform ewt)
|
transform_expect(struct weston_matrix *a, bool valid, enum wl_output_transform ewt)
|
||||||
{
|
{
|
||||||
enum wl_output_transform wt;
|
enum wl_output_transform wt;
|
||||||
|
|
||||||
assert(weston_matrix_to_transform(a, &wt) == valid);
|
test_assert_true(weston_matrix_to_transform(a, &wt) == valid);
|
||||||
if (valid)
|
if (valid)
|
||||||
assert(wt == ewt);
|
test_assert_true(wt == ewt);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(transformation_matrix)
|
TEST(transformation_matrix)
|
||||||
|
|
@ -57,26 +57,26 @@ TEST(transformation_matrix)
|
||||||
weston_matrix_init(&b);
|
weston_matrix_init(&b);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == 0);
|
test_assert_uint_eq(a.type, 0);
|
||||||
|
|
||||||
/* Make b a matrix that rotates a surface on the x,y plane by 90
|
/* Make b a matrix that rotates a surface on the x,y plane by 90
|
||||||
* degrees counter-clockwise */
|
* degrees counter-clockwise */
|
||||||
weston_matrix_rotate_xy(&b, 0, -1);
|
weston_matrix_rotate_xy(&b, 0, -1);
|
||||||
assert(b.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(b.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_90);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_90);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_180);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_180);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_270);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_270);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,38 +86,38 @@ TEST(transformation_matrix)
|
||||||
* standard transform and a rotation that fails to match any
|
* standard transform and a rotation that fails to match any
|
||||||
* known rotations. */
|
* known rotations. */
|
||||||
weston_matrix_rotate_xy(&b, cos(-M_PI / 4.0), sin(-M_PI / 4.0));
|
weston_matrix_rotate_xy(&b, cos(-M_PI / 4.0), sin(-M_PI / 4.0));
|
||||||
assert(b.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(b.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_90);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_90);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_180);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_180);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_270);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_270);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
assert(a.type == WESTON_MATRIX_TRANSFORM_ROTATE);
|
test_assert_enum(a.type, WESTON_MATRIX_TRANSFORM_ROTATE);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -136,35 +136,35 @@ TEST(transformation_matrix)
|
||||||
* matches a standard wl_output_transform should not need
|
* matches a standard wl_output_transform should not need
|
||||||
* filtering when used to transform images - but any
|
* filtering when used to transform images - but any
|
||||||
* matrix that fails to match will. */
|
* matrix that fails to match will. */
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_90);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_90);
|
||||||
assert(!weston_matrix_needs_filtering(&a));
|
test_assert_false(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
||||||
assert(!weston_matrix_needs_filtering(&a));
|
test_assert_false(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_270);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_270);
|
||||||
assert(!weston_matrix_needs_filtering(&a));
|
test_assert_false(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED);
|
||||||
assert(!weston_matrix_needs_filtering(&a));
|
test_assert_false(weston_matrix_needs_filtering(&a));
|
||||||
}
|
}
|
||||||
|
|
||||||
weston_matrix_init(&a);
|
weston_matrix_init(&a);
|
||||||
|
|
@ -206,35 +206,35 @@ TEST(transformation_matrix)
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_90);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_90);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_270);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_270);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, false, 0);
|
transform_expect(&a, false, 0);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_FLIPPED_180);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flipping Y should return us from here to normal */
|
/* Flipping Y should return us from here to normal */
|
||||||
|
|
@ -250,19 +250,19 @@ TEST(transformation_matrix)
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
|
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
assert(!weston_matrix_needs_filtering(&a));
|
test_assert_false(weston_matrix_needs_filtering(&a));
|
||||||
}
|
}
|
||||||
|
|
||||||
weston_matrix_init(&b);
|
weston_matrix_init(&b);
|
||||||
|
|
@ -270,19 +270,19 @@ TEST(transformation_matrix)
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
}
|
}
|
||||||
weston_matrix_invert(&b, &b);
|
weston_matrix_invert(&b, &b);
|
||||||
for (i = 0; i < 9; i++) {
|
for (i = 0; i < 9; i++) {
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
assert(weston_matrix_needs_filtering(&a));
|
test_assert_true(weston_matrix_needs_filtering(&a));
|
||||||
}
|
}
|
||||||
/* Last step should bring us back to a matrix that doesn't need
|
/* Last step should bring us back to a matrix that doesn't need
|
||||||
* a filter */
|
* a filter */
|
||||||
weston_matrix_multiply(&a, &b);
|
weston_matrix_multiply(&a, &b);
|
||||||
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
transform_expect(&a, true, WL_OUTPUT_TRANSFORM_NORMAL);
|
||||||
assert(!weston_matrix_needs_filtering(&a));
|
test_assert_false(weston_matrix_needs_filtering(&a));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -443,7 +443,7 @@ output_test_all_transforms(struct weston_output *output,
|
||||||
weston_matrix_transform(&output->matrix, &v);
|
weston_matrix_transform(&output->matrix, &v);
|
||||||
sv = simple_transform_vector(output, t);
|
sv = simple_transform_vector(output, t);
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
assert (sv.f[i] == v.f[i]);
|
test_assert_f32_eq (sv.f[i], v.f[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
#include "shared/xalloc.h"
|
#include "shared/xalloc.h"
|
||||||
#include "weston-output-capture-client-protocol.h"
|
#include "weston-output-capture-client-protocol.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "shared/weston-drm-fourcc.h"
|
#include "shared/weston-drm-fourcc.h"
|
||||||
|
|
||||||
struct setup_args {
|
struct setup_args {
|
||||||
|
|
@ -96,7 +97,7 @@ capture_source_handle_format(void *data,
|
||||||
{
|
{
|
||||||
struct capturer *capt = data;
|
struct capturer *capt = data;
|
||||||
|
|
||||||
assert(capt->source == proxy);
|
test_assert_ptr_eq(capt->source, proxy);
|
||||||
|
|
||||||
capt->events.format = true;
|
capt->events.format = true;
|
||||||
capt->drm_format = drm_format;
|
capt->drm_format = drm_format;
|
||||||
|
|
@ -109,7 +110,7 @@ capture_source_handle_size(void *data,
|
||||||
{
|
{
|
||||||
struct capturer *capt = data;
|
struct capturer *capt = data;
|
||||||
|
|
||||||
assert(capt->source == proxy);
|
test_assert_ptr_eq(capt->source, proxy);
|
||||||
|
|
||||||
capt->events.size = true;
|
capt->events.size = true;
|
||||||
capt->width = width;
|
capt->width = width;
|
||||||
|
|
@ -122,8 +123,8 @@ capture_source_handle_complete(void *data,
|
||||||
{
|
{
|
||||||
struct capturer *capt = data;
|
struct capturer *capt = data;
|
||||||
|
|
||||||
assert(capt->source == proxy);
|
test_assert_ptr_eq(capt->source, proxy);
|
||||||
assert(capt->state == CAPTURE_TASK_PENDING);
|
test_assert_enum(capt->state, CAPTURE_TASK_PENDING);
|
||||||
capt->state = CAPTURE_TASK_COMPLETE;
|
capt->state = CAPTURE_TASK_COMPLETE;
|
||||||
capt->events.reply = true;
|
capt->events.reply = true;
|
||||||
}
|
}
|
||||||
|
|
@ -134,8 +135,8 @@ capture_source_handle_retry(void *data,
|
||||||
{
|
{
|
||||||
struct capturer *capt = data;
|
struct capturer *capt = data;
|
||||||
|
|
||||||
assert(capt->source == proxy);
|
test_assert_ptr_eq(capt->source, proxy);
|
||||||
assert(capt->state == CAPTURE_TASK_PENDING);
|
test_assert_enum(capt->state, CAPTURE_TASK_PENDING);
|
||||||
capt->state = CAPTURE_TASK_RETRY;
|
capt->state = CAPTURE_TASK_RETRY;
|
||||||
capt->events.reply = true;
|
capt->events.reply = true;
|
||||||
}
|
}
|
||||||
|
|
@ -147,8 +148,8 @@ capture_source_handle_failed(void *data,
|
||||||
{
|
{
|
||||||
struct capturer *capt = data;
|
struct capturer *capt = data;
|
||||||
|
|
||||||
assert(capt->source == proxy);
|
test_assert_ptr_eq(capt->source, proxy);
|
||||||
assert(capt->state == CAPTURE_TASK_PENDING);
|
test_assert_enum(capt->state, CAPTURE_TASK_PENDING);
|
||||||
capt->state = CAPTURE_TASK_FAILED;
|
capt->state = CAPTURE_TASK_FAILED;
|
||||||
capt->events.reply = true;
|
capt->events.reply = true;
|
||||||
|
|
||||||
|
|
@ -210,22 +211,22 @@ TEST(simple_shot)
|
||||||
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER);
|
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
assert(capt->events.format);
|
test_assert_true(capt->events.format);
|
||||||
assert(capt->events.size);
|
test_assert_true(capt->events.size);
|
||||||
assert(capt->state == CAPTURE_TASK_PENDING);
|
test_assert_enum(capt->state, CAPTURE_TASK_PENDING);
|
||||||
assert(capt->drm_format == fix->expected_drm_format);
|
test_assert_u32_eq(capt->drm_format, fix->expected_drm_format);
|
||||||
assert(capt->width > 0);
|
test_assert_int_gt(capt->width, 0);
|
||||||
assert(capt->height > 0);
|
test_assert_int_gt(capt->height, 0);
|
||||||
assert(!capt->events.reply);
|
test_assert_false(capt->events.reply);
|
||||||
|
|
||||||
buf = create_shm_buffer(client, capt->width, capt->height,
|
buf = create_shm_buffer(client, capt->width, capt->height,
|
||||||
fix->expected_drm_format);
|
fix->expected_drm_format);
|
||||||
|
|
||||||
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
||||||
while (!capt->events.reply)
|
while (!capt->events.reply)
|
||||||
assert(wl_display_dispatch(client->wl_display) >= 0);
|
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||||
|
|
||||||
assert(capt->state == CAPTURE_TASK_COMPLETE);
|
test_assert_enum(capt->state, CAPTURE_TASK_COMPLETE);
|
||||||
|
|
||||||
capturer_destroy(capt);
|
capturer_destroy(capt);
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
|
|
@ -248,21 +249,24 @@ TEST(retry_on_wrong_format)
|
||||||
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER);
|
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
assert(capt->events.format);
|
test_assert_true(capt->events.format);
|
||||||
assert(capt->events.size);
|
test_assert_true(capt->events.size);
|
||||||
assert(capt->state == CAPTURE_TASK_PENDING);
|
test_assert_enum(capt->state, CAPTURE_TASK_PENDING);
|
||||||
assert(capt->drm_format != drm_format && "fix this test");
|
|
||||||
assert(capt->width > 0);
|
/* Fix this test if triggered. */
|
||||||
assert(capt->height > 0);
|
test_assert_u32_ne(capt->drm_format, drm_format);
|
||||||
assert(!capt->events.reply);
|
|
||||||
|
test_assert_int_gt(capt->width, 0);
|
||||||
|
test_assert_int_gt(capt->height, 0);
|
||||||
|
test_assert_false(capt->events.reply);
|
||||||
|
|
||||||
buf = create_shm_buffer(client, capt->width, capt->height, drm_format);
|
buf = create_shm_buffer(client, capt->width, capt->height, drm_format);
|
||||||
|
|
||||||
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
||||||
while (!capt->events.reply)
|
while (!capt->events.reply)
|
||||||
assert(wl_display_dispatch(client->wl_display) >= 0);
|
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||||
|
|
||||||
assert(capt->state == CAPTURE_TASK_RETRY);
|
test_assert_enum(capt->state, CAPTURE_TASK_RETRY);
|
||||||
|
|
||||||
capturer_destroy(capt);
|
capturer_destroy(capt);
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
|
|
@ -284,21 +288,21 @@ TEST(retry_on_wrong_size)
|
||||||
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER);
|
WESTON_CAPTURE_V1_SOURCE_FRAMEBUFFER);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
assert(capt->events.format);
|
test_assert_true(capt->events.format);
|
||||||
assert(capt->events.size);
|
test_assert_true(capt->events.size);
|
||||||
assert(capt->state == CAPTURE_TASK_PENDING);
|
test_assert_enum(capt->state, CAPTURE_TASK_PENDING);
|
||||||
assert(capt->width > 5);
|
test_assert_int_gt(capt->width, 5);
|
||||||
assert(capt->height > 5);
|
test_assert_int_gt(capt->height, 5);
|
||||||
assert(!capt->events.reply);
|
test_assert_false(capt->events.reply);
|
||||||
|
|
||||||
buf = create_shm_buffer(client, capt->width - 3, capt->height - 3,
|
buf = create_shm_buffer(client, capt->width - 3, capt->height - 3,
|
||||||
capt->drm_format);
|
capt->drm_format);
|
||||||
|
|
||||||
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
||||||
while (!capt->events.reply)
|
while (!capt->events.reply)
|
||||||
assert(wl_display_dispatch(client->wl_display) >= 0);
|
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||||
|
|
||||||
assert(capt->state == CAPTURE_TASK_RETRY);
|
test_assert_enum(capt->state, CAPTURE_TASK_RETRY);
|
||||||
|
|
||||||
capturer_destroy(capt);
|
capturer_destroy(capt);
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
|
|
@ -321,18 +325,18 @@ TEST(writeback_on_headless_fails)
|
||||||
WESTON_CAPTURE_V1_SOURCE_WRITEBACK);
|
WESTON_CAPTURE_V1_SOURCE_WRITEBACK);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
assert(!capt->events.format);
|
test_assert_false(capt->events.format);
|
||||||
assert(!capt->events.size);
|
test_assert_false(capt->events.size);
|
||||||
assert(capt->state == CAPTURE_TASK_PENDING);
|
test_assert_enum(capt->state, CAPTURE_TASK_PENDING);
|
||||||
|
|
||||||
/* Trying pixel source that is not available should fail immediately */
|
/* Trying pixel source that is not available should fail immediately */
|
||||||
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
weston_capture_source_v1_capture(capt->source, buf->proxy);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
assert(!capt->events.format);
|
test_assert_false(capt->events.format);
|
||||||
assert(!capt->events.size);
|
test_assert_false(capt->events.size);
|
||||||
assert(capt->state == CAPTURE_TASK_FAILED);
|
test_assert_enum(capt->state, CAPTURE_TASK_FAILED);
|
||||||
assert(strcmp(capt->last_failure, "source unavailable") == 0);
|
test_assert_str_eq(capt->last_failure, "source unavailable");
|
||||||
|
|
||||||
capturer_destroy(capt);
|
capturer_destroy(capt);
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
#define RENDERERS(s, t) \
|
#define RENDERERS(s, t) \
|
||||||
{ \
|
{ \
|
||||||
|
|
@ -199,7 +200,7 @@ TEST(output_damage)
|
||||||
|
|
||||||
ret = asprintf(&refname, "output-damage_%d-%s",
|
ret = asprintf(&refname, "output-damage_%d-%s",
|
||||||
oargs->scale, oargs->transform_name);
|
oargs->scale, oargs->transform_name);
|
||||||
assert(ret);
|
test_assert_int_ne(ret, 0);
|
||||||
|
|
||||||
testlog("%s: %s\n", get_test_name(), refname);
|
testlog("%s: %s\n", get_test_name(), refname);
|
||||||
|
|
||||||
|
|
@ -226,7 +227,7 @@ TEST(output_damage)
|
||||||
match = false;
|
match = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
for (i = 0; i < COUNT_BUFS; i++)
|
for (i = 0; i < COUNT_BUFS; i++)
|
||||||
buffer_destroy(buf[i]);
|
buffer_destroy(buf[i]);
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -76,7 +77,7 @@ TEST(output_decorations)
|
||||||
img = image_convert_to_a8r8g8b8(shot->image);
|
img = image_convert_to_a8r8g8b8(shot->image);
|
||||||
|
|
||||||
match = verify_image(img, "output-decorations", 0, NULL, 0);
|
match = verify_image(img, "output-decorations", 0, NULL, 0);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
pixman_image_unref(img);
|
pixman_image_unref(img);
|
||||||
buffer_destroy(shot);
|
buffer_destroy(shot);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
#define TRANSFORM(x) WL_OUTPUT_TRANSFORM_ ## x, #x
|
#define TRANSFORM(x) WL_OUTPUT_TRANSFORM_ ## x, #x
|
||||||
#define RENDERERS(s, t) \
|
#define RENDERERS(s, t) \
|
||||||
|
|
@ -122,7 +123,7 @@ TEST_P(output_transform, my_buffer_args)
|
||||||
ret = asprintf(&refname, "output_%d-%s_buffer_%d-%s",
|
ret = asprintf(&refname, "output_%d-%s_buffer_%d-%s",
|
||||||
oargs->scale, oargs->transform_name,
|
oargs->scale, oargs->transform_name,
|
||||||
bargs->scale, bargs->transform_name);
|
bargs->scale, bargs->transform_name);
|
||||||
assert(ret);
|
test_assert_int_ne(ret, 0);
|
||||||
|
|
||||||
testlog("%s: %s\n", get_test_name(), refname);
|
testlog("%s: %s\n", get_test_name(), refname);
|
||||||
|
|
||||||
|
|
@ -144,7 +145,7 @@ TEST_P(output_transform, my_buffer_args)
|
||||||
move_client(client, 19, 19);
|
move_client(client, 19, 19);
|
||||||
|
|
||||||
match = verify_screen_content(client, refname, 0, NULL, 0, NULL);
|
match = verify_screen_content(client, refname, 0, NULL, 0, NULL);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
free(refname);
|
free(refname);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "libweston-internal.h"
|
#include "libweston-internal.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -90,7 +91,7 @@ TEST(top_surface_present_in_output_repaint)
|
||||||
color_rgb888(&red, 255, 0, 0);
|
color_rgb888(&red, 255, 0, 0);
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 100, 100);
|
client = create_client_and_test_surface(100, 50, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move the pointer clearly away from our screenshooting area */
|
/* move the pointer clearly away from our screenshooting area */
|
||||||
weston_test_move_pointer(client->test->weston_test, 0, 1, 0, 2, 30);
|
weston_test_move_pointer(client->test->weston_test, 0, 1, 0, 2, 30);
|
||||||
|
|
@ -110,31 +111,31 @@ TEST(top_surface_present_in_output_repaint)
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct weston_buffer *buffer;
|
struct weston_buffer *buffer;
|
||||||
|
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
compositor = breakpoint->compositor;
|
compositor = breakpoint->compositor;
|
||||||
head = breakpoint->resource;
|
head = breakpoint->resource;
|
||||||
output = next_output(compositor, NULL);
|
output = next_output(compositor, NULL);
|
||||||
assert(output == head->output);
|
test_assert_ptr_eq(output, head->output);
|
||||||
assert(strcmp(output->name, "headless") == 0);
|
test_assert_str_eq(output->name, "headless");
|
||||||
assert(!next_output(compositor, output));
|
test_assert_ptr_null(next_output(compositor, output));
|
||||||
|
|
||||||
/* check that our surface is top of the paint node list */
|
/* check that our surface is top of the paint node list */
|
||||||
pnode = next_pnode_from_z(output, NULL);
|
pnode = next_pnode_from_z(output, NULL);
|
||||||
assert(pnode);
|
test_assert_ptr_not_null(pnode);
|
||||||
view = pnode->view;
|
view = pnode->view;
|
||||||
surface = view->surface;
|
surface = view->surface;
|
||||||
buffer = surface->buffer_ref.buffer;
|
buffer = surface->buffer_ref.buffer;
|
||||||
assert(surface->resource);
|
test_assert_ptr_not_null(surface->resource);
|
||||||
assert(wl_resource_get_client(surface->resource) ==
|
test_assert_ptr_eq(wl_resource_get_client(surface->resource),
|
||||||
suite_data->wl_client);
|
suite_data->wl_client);
|
||||||
assert(weston_view_is_mapped(view));
|
test_assert_true(weston_view_is_mapped(view));
|
||||||
assert(weston_surface_is_mapped(surface));
|
test_assert_true(weston_surface_is_mapped(surface));
|
||||||
assert(surface->width == 100);
|
test_assert_s32_eq(surface->width, 100);
|
||||||
assert(surface->height == 100);
|
test_assert_s32_eq(surface->height, 100);
|
||||||
assert(buffer->width == surface->width);
|
test_assert_s32_eq(buffer->width, surface->width);
|
||||||
assert(buffer->height == surface->height);
|
test_assert_s32_eq(buffer->height, surface->height);
|
||||||
assert(buffer->type == WESTON_BUFFER_SHM);
|
test_assert_enum(buffer->type, WESTON_BUFFER_SHM);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
|
|
@ -151,7 +152,7 @@ TEST(test_surface_unmaps_on_null)
|
||||||
color_rgb888(&red, 255, 0, 0);
|
color_rgb888(&red, 255, 0, 0);
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 100, 100);
|
client = create_client_and_test_surface(100, 50, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move the pointer clearly away from our screenshooting area */
|
/* move the pointer clearly away from our screenshooting area */
|
||||||
weston_test_move_pointer(client->test->weston_test, 0, 1, 0, 2, 30);
|
weston_test_move_pointer(client->test->weston_test, 0, 1, 0, 2, 30);
|
||||||
|
|
@ -171,30 +172,30 @@ TEST(test_surface_unmaps_on_null)
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct weston_buffer *buffer;
|
struct weston_buffer *buffer;
|
||||||
|
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
compositor = breakpoint->compositor;
|
compositor = breakpoint->compositor;
|
||||||
head = breakpoint->resource;
|
head = breakpoint->resource;
|
||||||
output = next_output(compositor, NULL);
|
output = next_output(compositor, NULL);
|
||||||
assert(output == head->output);
|
test_assert_ptr_eq(output, head->output);
|
||||||
assert(strcmp(output->name, "headless") == 0);
|
test_assert_str_eq(output->name, "headless");
|
||||||
assert(!next_output(compositor, output));
|
test_assert_ptr_null(next_output(compositor, output));
|
||||||
|
|
||||||
/* check that our surface is top of the paint node list */
|
/* check that our surface is top of the paint node list */
|
||||||
pnode = next_pnode_from_z(output, NULL);
|
pnode = next_pnode_from_z(output, NULL);
|
||||||
assert(pnode);
|
test_assert_ptr_not_null(pnode);
|
||||||
view = pnode->view;
|
view = pnode->view;
|
||||||
surface = view->surface;
|
surface = view->surface;
|
||||||
buffer = surface->buffer_ref.buffer;
|
buffer = surface->buffer_ref.buffer;
|
||||||
assert(wl_resource_get_client(surface->resource) ==
|
test_assert_ptr_eq(wl_resource_get_client(surface->resource),
|
||||||
suite_data->wl_client);
|
suite_data->wl_client);
|
||||||
assert(weston_view_is_mapped(view));
|
test_assert_true(weston_view_is_mapped(view));
|
||||||
assert(weston_surface_is_mapped(surface));
|
test_assert_true(weston_surface_is_mapped(surface));
|
||||||
assert(surface->width == 100);
|
test_assert_s32_eq(surface->width, 100);
|
||||||
assert(surface->height == 100);
|
test_assert_s32_eq(surface->height, 100);
|
||||||
assert(buffer->width == surface->width);
|
test_assert_s32_eq(buffer->width, surface->width);
|
||||||
assert(buffer->height == surface->height);
|
test_assert_s32_eq(buffer->height, surface->height);
|
||||||
assert(buffer->type == WESTON_BUFFER_SHM);
|
test_assert_enum(buffer->type, WESTON_BUFFER_SHM);
|
||||||
|
|
||||||
REARM_BREAKPOINT(breakpoint);
|
REARM_BREAKPOINT(breakpoint);
|
||||||
}
|
}
|
||||||
|
|
@ -211,24 +212,24 @@ TEST(test_surface_unmaps_on_null)
|
||||||
struct weston_surface *surface;
|
struct weston_surface *surface;
|
||||||
struct weston_buffer *buffer;
|
struct weston_buffer *buffer;
|
||||||
|
|
||||||
assert(breakpoint->template_->breakpoint ==
|
test_assert_enum(breakpoint->template_->breakpoint,
|
||||||
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
WESTON_TEST_BREAKPOINT_POST_REPAINT);
|
||||||
compositor = breakpoint->compositor;
|
compositor = breakpoint->compositor;
|
||||||
head = breakpoint->resource;
|
head = breakpoint->resource;
|
||||||
output = next_output(compositor, NULL);
|
output = next_output(compositor, NULL);
|
||||||
assert(output == head->output);
|
test_assert_ptr_eq(output, head->output);
|
||||||
assert(strcmp(output->name, "headless") == 0);
|
test_assert_str_eq(output->name, "headless");
|
||||||
assert(!next_output(compositor, output));
|
test_assert_ptr_null(next_output(compositor, output));
|
||||||
|
|
||||||
/* check that our NULL-buffer commit removed the surface from
|
/* check that our NULL-buffer commit removed the surface from
|
||||||
* view */
|
* view */
|
||||||
pnode = next_pnode_from_z(output, NULL);
|
pnode = next_pnode_from_z(output, NULL);
|
||||||
assert(pnode);
|
test_assert_ptr_not_null(pnode);
|
||||||
view = pnode->view;
|
view = pnode->view;
|
||||||
surface = view->surface;
|
surface = view->surface;
|
||||||
buffer = surface->buffer_ref.buffer;
|
buffer = surface->buffer_ref.buffer;
|
||||||
assert(!surface->resource);
|
test_assert_ptr_null(surface->resource);
|
||||||
assert(buffer->type == WESTON_BUFFER_SOLID);
|
test_assert_enum(buffer->type, WESTON_BUFFER_SOLID);
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer_destroy(buf);
|
buffer_destroy(buf);
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,12 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <libweston/libweston.h>
|
#include <libweston/libweston.h>
|
||||||
#include <libweston/plugin-registry.h>
|
#include <libweston/plugin-registry.h>
|
||||||
|
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -65,20 +64,23 @@ static const struct my_api {
|
||||||
static void
|
static void
|
||||||
init_tests(struct weston_compositor *compositor)
|
init_tests(struct weston_compositor *compositor)
|
||||||
{
|
{
|
||||||
assert(weston_plugin_api_get(compositor, MY_API_NAME,
|
test_assert_ptr_null(weston_plugin_api_get(compositor, MY_API_NAME,
|
||||||
sizeof(my_test_api)) == NULL);
|
sizeof(my_test_api)));
|
||||||
|
|
||||||
assert(weston_plugin_api_register(compositor, MY_API_NAME, &my_test_api,
|
test_assert_int_eq(weston_plugin_api_register(compositor, MY_API_NAME,
|
||||||
sizeof(my_test_api)) == 0);
|
&my_test_api,
|
||||||
|
sizeof(my_test_api)), 0);
|
||||||
|
|
||||||
assert(weston_plugin_api_register(compositor, MY_API_NAME, &my_test_api,
|
test_assert_int_eq(weston_plugin_api_register(compositor, MY_API_NAME,
|
||||||
sizeof(my_test_api)) == -2);
|
&my_test_api,
|
||||||
|
sizeof(my_test_api)), -2);
|
||||||
|
|
||||||
assert(weston_plugin_api_get(compositor, MY_API_NAME,
|
test_assert_ptr_eq(weston_plugin_api_get(compositor, MY_API_NAME,
|
||||||
sizeof(my_test_api)) == &my_test_api);
|
sizeof(my_test_api)), &my_test_api);
|
||||||
|
|
||||||
assert(weston_plugin_api_register(compositor, "another", &my_test_api,
|
test_assert_int_eq(weston_plugin_api_register(compositor, "another",
|
||||||
sizeof(my_test_api)) == 0);
|
&my_test_api,
|
||||||
|
sizeof(my_test_api)), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
PLUGIN_TEST(plugin_registry_test)
|
PLUGIN_TEST(plugin_registry_test)
|
||||||
|
|
@ -89,14 +91,15 @@ PLUGIN_TEST(plugin_registry_test)
|
||||||
|
|
||||||
init_tests(compositor);
|
init_tests(compositor);
|
||||||
|
|
||||||
assert(weston_plugin_api_get(compositor, MY_API_NAME, sz) ==
|
test_assert_ptr_eq(weston_plugin_api_get(compositor, MY_API_NAME, sz),
|
||||||
&my_test_api);
|
&my_test_api);
|
||||||
|
|
||||||
assert(weston_plugin_api_get(compositor, MY_API_NAME, sz - 4) ==
|
test_assert_ptr_eq(weston_plugin_api_get(compositor, MY_API_NAME, sz - 4),
|
||||||
&my_test_api);
|
&my_test_api);
|
||||||
|
|
||||||
assert(weston_plugin_api_get(compositor, MY_API_NAME, sz + 4) == NULL);
|
test_assert_ptr_null(weston_plugin_api_get(compositor, MY_API_NAME, sz + 4));
|
||||||
|
|
||||||
api = weston_plugin_api_get(compositor, MY_API_NAME, sz);
|
api = weston_plugin_api_get(compositor, MY_API_NAME, sz);
|
||||||
assert(api && api->func2 == dummy_func);
|
test_assert_ptr_not_null(api);
|
||||||
|
test_assert_ptr_eq(api->func2, dummy_func);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "shared/timespec-util.h"
|
#include "shared/timespec-util.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
struct setup_args {
|
struct setup_args {
|
||||||
struct fixture_metadata meta;
|
struct fixture_metadata meta;
|
||||||
|
|
@ -93,7 +94,7 @@ surface_commit_color(struct client *client, struct surface *surface,
|
||||||
wl_surface_damage(surface->wl_surface, 0, 0, width, height);
|
wl_surface_damage(surface->wl_surface, 0, 0, width, height);
|
||||||
wl_surface_commit(surface->wl_surface);
|
wl_surface_commit(surface->wl_surface);
|
||||||
|
|
||||||
assert(!surface->buffer);
|
test_assert_ptr_null(surface->buffer);
|
||||||
surface->buffer = buf;
|
surface->buffer = buf;
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
@ -151,7 +152,7 @@ TEST(pointer_cursor_retains_committed_buffer_after_reenter)
|
||||||
main_cursor_surface->wl_surface, 0, 0);
|
main_cursor_surface->wl_surface, 0, 0);
|
||||||
match = verify_screen_content(client, "pointer_cursor_reenter", 0,
|
match = verify_screen_content(client, "pointer_cursor_reenter", 0,
|
||||||
NULL, 0, NULL);
|
NULL, 0, NULL);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
/* Move the cursor just outside the main surface. */
|
/* Move the cursor just outside the main surface. */
|
||||||
send_motion(client, &t2, 150, 150);
|
send_motion(client, &t2, 150, 150);
|
||||||
|
|
@ -160,7 +161,7 @@ TEST(pointer_cursor_retains_committed_buffer_after_reenter)
|
||||||
back_cursor_surface->wl_surface, 0, 0);
|
back_cursor_surface->wl_surface, 0, 0);
|
||||||
match = verify_screen_content(client, "pointer_cursor_reenter", 1,
|
match = verify_screen_content(client, "pointer_cursor_reenter", 1,
|
||||||
NULL, 1, NULL);
|
NULL, 1, NULL);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
/* And back in the main surface again. */
|
/* And back in the main surface again. */
|
||||||
send_motion(client, &t3, 149, 149);
|
send_motion(client, &t3, 149, 149);
|
||||||
|
|
@ -169,7 +170,7 @@ TEST(pointer_cursor_retains_committed_buffer_after_reenter)
|
||||||
main_cursor_surface->wl_surface, 0, 0);
|
main_cursor_surface->wl_surface, 0, 0);
|
||||||
match = verify_screen_content(client, "pointer_cursor_reenter", 2,
|
match = verify_screen_content(client, "pointer_cursor_reenter", 2,
|
||||||
NULL, 2, NULL);
|
NULL, 2, NULL);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
surface_destroy(back_cursor_surface);
|
surface_destroy(back_cursor_surface);
|
||||||
surface_destroy(main_cursor_surface);
|
surface_destroy(main_cursor_surface);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "shared/timespec-util.h"
|
#include "shared/timespec-util.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -92,13 +93,14 @@ check_pointer(struct client *client, int x, int y)
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
|
|
||||||
/* check that the client got the global pointer update */
|
/* check that the client got the global pointer update */
|
||||||
assert(client->test->pointer_x == x);
|
test_assert_int_eq(client->test->pointer_x, x);
|
||||||
assert(client->test->pointer_y == y);
|
test_assert_int_eq(client->test->pointer_y, y);
|
||||||
|
|
||||||
/* Does global pointer map onto the surface? */
|
/* Does global pointer map onto the surface? */
|
||||||
if (surface_contains(client->surface, x, y)) {
|
if (surface_contains(client->surface, x, y)) {
|
||||||
/* check that the surface has the pointer focus */
|
/* check that the surface has the pointer focus */
|
||||||
assert(client->input->pointer->focus == client->surface);
|
test_assert_ptr_eq(client->input->pointer->focus,
|
||||||
|
client->surface);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check that the local surface pointer maps
|
* check that the local surface pointer maps
|
||||||
|
|
@ -106,14 +108,14 @@ check_pointer(struct client *client, int x, int y)
|
||||||
*/
|
*/
|
||||||
sx = client->input->pointer->x + client->surface->x;
|
sx = client->input->pointer->x + client->surface->x;
|
||||||
sy = client->input->pointer->y + client->surface->y;
|
sy = client->input->pointer->y + client->surface->y;
|
||||||
assert(sx == x);
|
test_assert_int_eq(sx, x);
|
||||||
assert(sy == y);
|
test_assert_int_eq(sy, y);
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* The global pointer does not map onto surface. So
|
* The global pointer does not map onto surface. So
|
||||||
* check that it doesn't have the pointer focus.
|
* check that it doesn't have the pointer focus.
|
||||||
*/
|
*/
|
||||||
assert(client->input->pointer->focus == NULL);
|
test_assert_ptr_null(client->input->pointer->focus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,7 +130,7 @@ static struct client *
|
||||||
create_client_with_pointer_focus(int x, int y, int w, int h)
|
create_client_with_pointer_focus(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
struct client *cl = create_client_and_test_surface(x, y, w, h);
|
struct client *cl = create_client_and_test_surface(x, y, w, h);
|
||||||
assert(cl);
|
test_assert_ptr_not_null(cl);
|
||||||
/* Move the pointer inside the surface to ensure that the surface
|
/* Move the pointer inside the surface to ensure that the surface
|
||||||
* has the pointer focus. */
|
* has the pointer focus. */
|
||||||
check_pointer_move(cl, x, y);
|
check_pointer_move(cl, x, y);
|
||||||
|
|
@ -141,22 +143,22 @@ TEST(test_pointer_top_left)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(46, 76, 111, 134);
|
client = create_client_and_test_surface(46, 76, 111, 134);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside top left */
|
/* move pointer outside top left */
|
||||||
x = client->surface->x - 1;
|
x = client->surface->x - 1;
|
||||||
y = client->surface->y - 1;
|
y = client->surface->y - 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer on top left */
|
/* move pointer on top left */
|
||||||
x += 1; y += 1;
|
x += 1; y += 1;
|
||||||
assert(surface_contains(client->surface, x, y));
|
test_assert_true(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer outside top left */
|
/* move pointer outside top left */
|
||||||
x -= 1; y -= 1;
|
x -= 1; y -= 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -168,22 +170,22 @@ TEST(test_pointer_bottom_left)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(99, 100, 100, 98);
|
client = create_client_and_test_surface(99, 100, 100, 98);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside bottom left */
|
/* move pointer outside bottom left */
|
||||||
x = client->surface->x - 1;
|
x = client->surface->x - 1;
|
||||||
y = client->surface->y + client->surface->height;
|
y = client->surface->y + client->surface->height;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer on bottom left */
|
/* move pointer on bottom left */
|
||||||
x += 1; y -= 1;
|
x += 1; y -= 1;
|
||||||
assert(surface_contains(client->surface, x, y));
|
test_assert_true(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer outside bottom left */
|
/* move pointer outside bottom left */
|
||||||
x -= 1; y += 1;
|
x -= 1; y += 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -195,22 +197,22 @@ TEST(test_pointer_top_right)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(48, 100, 67, 100);
|
client = create_client_and_test_surface(48, 100, 67, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside top right */
|
/* move pointer outside top right */
|
||||||
x = client->surface->x + client->surface->width;
|
x = client->surface->x + client->surface->width;
|
||||||
y = client->surface->y - 1;
|
y = client->surface->y - 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer on top right */
|
/* move pointer on top right */
|
||||||
x -= 1; y += 1;
|
x -= 1; y += 1;
|
||||||
assert(surface_contains(client->surface, x, y));
|
test_assert_true(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer outside top right */
|
/* move pointer outside top right */
|
||||||
x += 1; y -= 1;
|
x += 1; y -= 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -222,22 +224,22 @@ TEST(test_pointer_bottom_right)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 123, 100, 69);
|
client = create_client_and_test_surface(100, 123, 100, 69);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside bottom right */
|
/* move pointer outside bottom right */
|
||||||
x = client->surface->x + client->surface->width;
|
x = client->surface->x + client->surface->width;
|
||||||
y = client->surface->y + client->surface->height;
|
y = client->surface->y + client->surface->height;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer on bottom right */
|
/* move pointer on bottom right */
|
||||||
x -= 1; y -= 1;
|
x -= 1; y -= 1;
|
||||||
assert(surface_contains(client->surface, x, y));
|
test_assert_true(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer outside bottom right */
|
/* move pointer outside bottom right */
|
||||||
x += 1; y += 1;
|
x += 1; y += 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -249,22 +251,22 @@ TEST(test_pointer_top_center)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 201, 100, 50);
|
client = create_client_and_test_surface(100, 201, 100, 50);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside top center */
|
/* move pointer outside top center */
|
||||||
x = client->surface->x + client->surface->width/2;
|
x = client->surface->x + client->surface->width/2;
|
||||||
y = client->surface->y - 1;
|
y = client->surface->y - 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer on top center */
|
/* move pointer on top center */
|
||||||
y += 1;
|
y += 1;
|
||||||
assert(surface_contains(client->surface, x, y));
|
test_assert_true(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer outside top center */
|
/* move pointer outside top center */
|
||||||
y -= 1;
|
y -= 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -276,22 +278,22 @@ TEST(test_pointer_bottom_center)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 45, 67, 100);
|
client = create_client_and_test_surface(100, 45, 67, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside bottom center */
|
/* move pointer outside bottom center */
|
||||||
x = client->surface->x + client->surface->width/2;
|
x = client->surface->x + client->surface->width/2;
|
||||||
y = client->surface->y + client->surface->height;
|
y = client->surface->y + client->surface->height;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer on bottom center */
|
/* move pointer on bottom center */
|
||||||
y -= 1;
|
y -= 1;
|
||||||
assert(surface_contains(client->surface, x, y));
|
test_assert_true(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer outside bottom center */
|
/* move pointer outside bottom center */
|
||||||
y += 1;
|
y += 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -303,22 +305,22 @@ TEST(test_pointer_left_center)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(167, 45, 78, 100);
|
client = create_client_and_test_surface(167, 45, 78, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside left center */
|
/* move pointer outside left center */
|
||||||
x = client->surface->x - 1;
|
x = client->surface->x - 1;
|
||||||
y = client->surface->y + client->surface->height/2;
|
y = client->surface->y + client->surface->height/2;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer on left center */
|
/* move pointer on left center */
|
||||||
x += 1;
|
x += 1;
|
||||||
assert(surface_contains(client->surface, x, y));
|
test_assert_true(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer outside left center */
|
/* move pointer outside left center */
|
||||||
x -= 1;
|
x -= 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -330,22 +332,22 @@ TEST(test_pointer_right_center)
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
client = create_client_and_test_surface(110, 37, 100, 46);
|
client = create_client_and_test_surface(110, 37, 100, 46);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside right center */
|
/* move pointer outside right center */
|
||||||
x = client->surface->x + client->surface->width;
|
x = client->surface->x + client->surface->width;
|
||||||
y = client->surface->y + client->surface->height/2;
|
y = client->surface->y + client->surface->height/2;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer on right center */
|
/* move pointer on right center */
|
||||||
x -= 1;
|
x -= 1;
|
||||||
assert(surface_contains(client->surface, x, y));
|
test_assert_true(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
/* move pointer outside right center */
|
/* move pointer outside right center */
|
||||||
x += 1;
|
x += 1;
|
||||||
assert(!surface_contains(client->surface, x, y));
|
test_assert_false(surface_contains(client->surface, x, y));
|
||||||
check_pointer_move(client, x, y);
|
check_pointer_move(client, x, y);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -356,15 +358,15 @@ TEST(test_pointer_surface_move)
|
||||||
struct client *client;
|
struct client *client;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 100, 100, 100);
|
client = create_client_and_test_surface(100, 100, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
/* move pointer outside of client */
|
/* move pointer outside of client */
|
||||||
assert(!surface_contains(client->surface, 50, 50));
|
test_assert_false(surface_contains(client->surface, 50, 50));
|
||||||
check_pointer_move(client, 50, 50);
|
check_pointer_move(client, 50, 50);
|
||||||
|
|
||||||
/* move client center to pointer */
|
/* move client center to pointer */
|
||||||
move_client_frame_sync(client, 0, 0);
|
move_client_frame_sync(client, 0, 0);
|
||||||
assert(surface_contains(client->surface, 50, 50));
|
test_assert_true(surface_contains(client->surface, 50, 50));
|
||||||
check_pointer(client, 50, 50);
|
check_pointer(client, 50, 50);
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
@ -379,10 +381,10 @@ TEST(pointer_motion_events)
|
||||||
input_timestamps_create_for_pointer(client);
|
input_timestamps_create_for_pointer(client);
|
||||||
|
|
||||||
send_motion(client, &t1, 150, 150);
|
send_motion(client, &t1, 150, 150);
|
||||||
assert(pointer->x == 50);
|
test_assert_int_eq(pointer->x, 50);
|
||||||
assert(pointer->y == 50);
|
test_assert_int_eq(pointer->y, 50);
|
||||||
assert(pointer->motion_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(pointer->motion_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&pointer->motion_time_timespec, &t1));
|
test_assert_true(timespec_eq(&pointer->motion_time_timespec, &t1));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
|
|
@ -397,20 +399,20 @@ TEST(pointer_button_events)
|
||||||
struct input_timestamps *input_ts =
|
struct input_timestamps *input_ts =
|
||||||
input_timestamps_create_for_pointer(client);
|
input_timestamps_create_for_pointer(client);
|
||||||
|
|
||||||
assert(pointer->button == 0);
|
test_assert_u32_eq(pointer->button, 0);
|
||||||
assert(pointer->state == 0);
|
test_assert_u32_eq(pointer->state, 0);
|
||||||
|
|
||||||
send_button(client, &t1, BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED);
|
send_button(client, &t1, BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED);
|
||||||
assert(pointer->button == BTN_LEFT);
|
test_assert_enum(pointer->button, BTN_LEFT);
|
||||||
assert(pointer->state == WL_POINTER_BUTTON_STATE_PRESSED);
|
test_assert_enum(pointer->state, WL_POINTER_BUTTON_STATE_PRESSED);
|
||||||
assert(pointer->button_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(pointer->button_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&pointer->button_time_timespec, &t1));
|
test_assert_true(timespec_eq(&pointer->button_time_timespec, &t1));
|
||||||
|
|
||||||
send_button(client, &t2, BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED);
|
send_button(client, &t2, BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
assert(pointer->button == BTN_LEFT);
|
test_assert_enum(pointer->button, BTN_LEFT);
|
||||||
assert(pointer->state == WL_POINTER_BUTTON_STATE_RELEASED);
|
test_assert_enum(pointer->state, WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
assert(pointer->button_time_msec == timespec_to_msec(&t2));
|
test_assert_s64_eq(pointer->button_time_msec, timespec_to_msec(&t2));
|
||||||
assert(timespec_eq(&pointer->button_time_timespec, &t2));
|
test_assert_true(timespec_eq(&pointer->button_time_timespec, &t2));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
|
|
@ -426,15 +428,15 @@ TEST(pointer_axis_events)
|
||||||
input_timestamps_create_for_pointer(client);
|
input_timestamps_create_for_pointer(client);
|
||||||
|
|
||||||
send_axis(client, &t1, 1, 1.0);
|
send_axis(client, &t1, 1, 1.0);
|
||||||
assert(pointer->axis == 1);
|
test_assert_u32_eq(pointer->axis, 1);
|
||||||
assert(pointer->axis_value == 1.0);
|
test_assert_f64_eq(pointer->axis_value, 1.0);
|
||||||
assert(pointer->axis_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(pointer->axis_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&pointer->axis_time_timespec, &t1));
|
test_assert_true(timespec_eq(&pointer->axis_time_timespec, &t1));
|
||||||
|
|
||||||
send_axis(client, &t2, 2, 0.0);
|
send_axis(client, &t2, 2, 0.0);
|
||||||
assert(pointer->axis == 2);
|
test_assert_u32_eq(pointer->axis, 2);
|
||||||
assert(pointer->axis_stop_time_msec == timespec_to_msec(&t2));
|
test_assert_s64_eq(pointer->axis_stop_time_msec, timespec_to_msec(&t2));
|
||||||
assert(timespec_eq(&pointer->axis_stop_time_timespec, &t2));
|
test_assert_true(timespec_eq(&pointer->axis_stop_time_timespec, &t2));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
|
|
@ -450,18 +452,18 @@ TEST(pointer_timestamps_stop_after_input_timestamps_object_is_destroyed)
|
||||||
input_timestamps_create_for_pointer(client);
|
input_timestamps_create_for_pointer(client);
|
||||||
|
|
||||||
send_button(client, &t1, BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED);
|
send_button(client, &t1, BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED);
|
||||||
assert(pointer->button == BTN_LEFT);
|
test_assert_enum(pointer->button, BTN_LEFT);
|
||||||
assert(pointer->state == WL_POINTER_BUTTON_STATE_PRESSED);
|
test_assert_enum(pointer->state, WL_POINTER_BUTTON_STATE_PRESSED);
|
||||||
assert(pointer->button_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(pointer->button_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&pointer->button_time_timespec, &t1));
|
test_assert_true(timespec_eq(&pointer->button_time_timespec, &t1));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
send_button(client, &t2, BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED);
|
send_button(client, &t2, BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
assert(pointer->button == BTN_LEFT);
|
test_assert_enum(pointer->button, BTN_LEFT);
|
||||||
assert(pointer->state == WL_POINTER_BUTTON_STATE_RELEASED);
|
test_assert_enum(pointer->state, WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
assert(pointer->button_time_msec == timespec_to_msec(&t2));
|
test_assert_s64_eq(pointer->button_time_msec, timespec_to_msec(&t2));
|
||||||
assert(timespec_is_zero(&pointer->button_time_timespec));
|
test_assert_true(timespec_is_zero(&pointer->button_time_timespec));
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
}
|
}
|
||||||
|
|
@ -475,10 +477,10 @@ TEST(pointer_timestamps_stop_after_client_releases_wl_pointer)
|
||||||
input_timestamps_create_for_pointer(client);
|
input_timestamps_create_for_pointer(client);
|
||||||
|
|
||||||
send_motion(client, &t1, 150, 150);
|
send_motion(client, &t1, 150, 150);
|
||||||
assert(pointer->x == 50);
|
test_assert_int_eq(pointer->x, 50);
|
||||||
assert(pointer->y == 50);
|
test_assert_int_eq(pointer->y, 50);
|
||||||
assert(pointer->motion_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(pointer->motion_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&pointer->motion_time_timespec, &t1));
|
test_assert_true(timespec_eq(&pointer->motion_time_timespec, &t1));
|
||||||
|
|
||||||
wl_pointer_release(client->input->pointer->wl_pointer);
|
wl_pointer_release(client->input->pointer->wl_pointer);
|
||||||
|
|
||||||
|
|
@ -489,7 +491,7 @@ TEST(pointer_timestamps_stop_after_client_releases_wl_pointer)
|
||||||
* event and checking for it here may lead to false negatives. */
|
* event and checking for it here may lead to false negatives. */
|
||||||
pointer->input_timestamp = t_other;
|
pointer->input_timestamp = t_other;
|
||||||
send_motion(client, &t2, 175, 175);
|
send_motion(client, &t2, 175, 175);
|
||||||
assert(timespec_eq(&pointer->input_timestamp, &t_other));
|
test_assert_true(timespec_eq(&pointer->input_timestamp, &t_other));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "shared/helpers.h"
|
#include "shared/helpers.h"
|
||||||
|
|
@ -38,6 +37,7 @@
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "presentation-time-client-protocol.h"
|
#include "presentation-time-client-protocol.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -64,18 +64,18 @@ get_presentation(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_pres)
|
if (global_pres)
|
||||||
assert(0 && "multiple presentation objects");
|
test_assert_not_reached("multiple presentation objects");
|
||||||
|
|
||||||
global_pres = g;
|
global_pres = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_pres && "no presentation found");
|
test_assert_ptr_not_null(global_pres);
|
||||||
|
|
||||||
assert(global_pres->version == 1);
|
test_assert_u32_eq(global_pres->version, 1);
|
||||||
|
|
||||||
pres = wl_registry_bind(client->wl_registry, global_pres->name,
|
pres = wl_registry_bind(client->wl_registry, global_pres->name,
|
||||||
&wp_presentation_interface, 1);
|
&wp_presentation_interface, 1);
|
||||||
assert(pres);
|
test_assert_ptr_not_null(pres);
|
||||||
|
|
||||||
return pres;
|
return pres;
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ feedback_sync_output(void *data,
|
||||||
{
|
{
|
||||||
struct feedback *fb = data;
|
struct feedback *fb = data;
|
||||||
|
|
||||||
assert(fb->result == FB_PENDING);
|
test_assert_enum(fb->result, FB_PENDING);
|
||||||
|
|
||||||
if (output)
|
if (output)
|
||||||
fb->sync_output = output;
|
fb->sync_output = output;
|
||||||
|
|
@ -123,7 +123,7 @@ feedback_presented(void *data,
|
||||||
{
|
{
|
||||||
struct feedback *fb = data;
|
struct feedback *fb = data;
|
||||||
|
|
||||||
assert(fb->result == FB_PENDING);
|
test_assert_enum(fb->result, FB_PENDING);
|
||||||
fb->result = FB_PRESENTED;
|
fb->result = FB_PRESENTED;
|
||||||
fb->seq = u64_from_u32s(seq_hi, seq_lo);
|
fb->seq = u64_from_u32s(seq_hi, seq_lo);
|
||||||
timespec_from_proto(&fb->time, tv_sec_hi, tv_sec_lo, tv_nsec);
|
timespec_from_proto(&fb->time, tv_sec_hi, tv_sec_lo, tv_nsec);
|
||||||
|
|
@ -137,7 +137,7 @@ feedback_discarded(void *data,
|
||||||
{
|
{
|
||||||
struct feedback *fb = data;
|
struct feedback *fb = data;
|
||||||
|
|
||||||
assert(fb->result == FB_PENDING);
|
test_assert_enum(fb->result, FB_PENDING);
|
||||||
fb->result = FB_DISCARDED;
|
fb->result = FB_DISCARDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -166,7 +166,7 @@ static void
|
||||||
feedback_wait(struct feedback *fb)
|
feedback_wait(struct feedback *fb)
|
||||||
{
|
{
|
||||||
while (fb->result == FB_PENDING) {
|
while (fb->result == FB_PENDING) {
|
||||||
assert(wl_display_dispatch(fb->client->wl_display) >= 0);
|
test_assert_int_ge(wl_display_dispatch(fb->client->wl_display), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -231,7 +231,7 @@ TEST(test_presentation_feedback_simple)
|
||||||
struct wp_presentation *pres;
|
struct wp_presentation *pres;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
pres = get_presentation(client);
|
pres = get_presentation(client);
|
||||||
|
|
||||||
wl_surface_attach(client->surface->wl_surface,
|
wl_surface_attach(client->surface->wl_surface,
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
#include "xdg-shell-client-protocol.h"
|
#include "xdg-shell-client-protocol.h"
|
||||||
|
|
||||||
|
|
@ -60,18 +60,18 @@ get_subcompositor(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_sub)
|
if (global_sub)
|
||||||
assert(0 && "multiple wl_subcompositor objects");
|
test_assert_not_reached("multiple wl_subcompositor objects");
|
||||||
|
|
||||||
global_sub = g;
|
global_sub = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_sub && "no wl_subcompositor found");
|
test_assert_ptr_not_null(global_sub);
|
||||||
|
|
||||||
assert(global_sub->version == 1);
|
test_assert_u32_eq(global_sub->version, 1);
|
||||||
|
|
||||||
sub = wl_registry_bind(client->wl_registry, global_sub->name,
|
sub = wl_registry_bind(client->wl_registry, global_sub->name,
|
||||||
&wl_subcompositor_interface, 1);
|
&wl_subcompositor_interface, 1);
|
||||||
assert(sub);
|
test_assert_ptr_not_null(sub);
|
||||||
|
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
@ -88,16 +88,16 @@ get_xdg_wm_base(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global)
|
if (global)
|
||||||
assert(0 && "multiple xdg_wm_base objects");
|
test_assert_not_reached("multiple xdg_wm_base objects");
|
||||||
|
|
||||||
global = g;
|
global = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global && "no xdg_wm_base found");
|
test_assert_ptr_not_null(global);
|
||||||
|
|
||||||
xdg_wm_base = wl_registry_bind(client->wl_registry, global->name,
|
xdg_wm_base = wl_registry_bind(client->wl_registry, global->name,
|
||||||
&xdg_wm_base_interface, 1);
|
&xdg_wm_base_interface, 1);
|
||||||
assert(xdg_wm_base);
|
test_assert_ptr_not_null(xdg_wm_base);
|
||||||
|
|
||||||
return xdg_wm_base;
|
return xdg_wm_base;
|
||||||
}
|
}
|
||||||
|
|
@ -112,19 +112,19 @@ TEST(test_role_conflict_sub_wlshell)
|
||||||
struct xdg_surface *xdg_surface;
|
struct xdg_surface *xdg_surface;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
xdg_wm_base = get_xdg_wm_base(client);
|
xdg_wm_base = get_xdg_wm_base(client);
|
||||||
|
|
||||||
child = wl_compositor_create_surface(client->wl_compositor);
|
child = wl_compositor_create_surface(client->wl_compositor);
|
||||||
assert(child);
|
test_assert_ptr_not_null(child);
|
||||||
sub = wl_subcompositor_get_subsurface(subco, child,
|
sub = wl_subcompositor_get_subsurface(subco, child,
|
||||||
client->surface->wl_surface);
|
client->surface->wl_surface);
|
||||||
assert(sub);
|
test_assert_ptr_not_null(sub);
|
||||||
|
|
||||||
xdg_surface = xdg_wm_base_get_xdg_surface(xdg_wm_base, child);
|
xdg_surface = xdg_wm_base_get_xdg_surface(xdg_wm_base, child);
|
||||||
assert(xdg_surface);
|
test_assert_ptr_not_null(xdg_surface);
|
||||||
|
|
||||||
expect_protocol_error(client, &xdg_wm_base_interface,
|
expect_protocol_error(client, &xdg_wm_base_interface,
|
||||||
XDG_WM_BASE_ERROR_ROLE);
|
XDG_WM_BASE_ERROR_ROLE);
|
||||||
|
|
@ -148,21 +148,21 @@ TEST(test_role_conflict_wlshell_sub)
|
||||||
struct xdg_toplevel *xdg_toplevel;
|
struct xdg_toplevel *xdg_toplevel;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
xdg_wm_base = get_xdg_wm_base(client);
|
xdg_wm_base = get_xdg_wm_base(client);
|
||||||
|
|
||||||
child = wl_compositor_create_surface(client->wl_compositor);
|
child = wl_compositor_create_surface(client->wl_compositor);
|
||||||
assert(child);
|
test_assert_ptr_not_null(child);
|
||||||
xdg_surface = xdg_wm_base_get_xdg_surface(xdg_wm_base, child);
|
xdg_surface = xdg_wm_base_get_xdg_surface(xdg_wm_base, child);
|
||||||
assert(xdg_surface);
|
test_assert_ptr_not_null(xdg_surface);
|
||||||
xdg_toplevel = xdg_surface_get_toplevel(xdg_surface);
|
xdg_toplevel = xdg_surface_get_toplevel(xdg_surface);
|
||||||
assert(xdg_toplevel);
|
test_assert_ptr_not_null(xdg_toplevel);
|
||||||
|
|
||||||
sub = wl_subcompositor_get_subsurface(subco, child,
|
sub = wl_subcompositor_get_subsurface(subco, child,
|
||||||
client->surface->wl_surface);
|
client->surface->wl_surface);
|
||||||
assert(sub);
|
test_assert_ptr_not_null(sub);
|
||||||
|
|
||||||
expect_protocol_error(client, &wl_subcompositor_interface,
|
expect_protocol_error(client, &wl_subcompositor_interface,
|
||||||
WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE);
|
WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -106,13 +106,13 @@ shm_buffer_create(struct client *client,
|
||||||
buf->height = height;
|
buf->height = height;
|
||||||
|
|
||||||
fd = os_create_anonymous_file(buf->bytes);
|
fd = os_create_anonymous_file(buf->bytes);
|
||||||
assert(fd >= 0);
|
test_assert_int_ge(fd, 0);
|
||||||
|
|
||||||
buf->data = mmap(NULL, buf->bytes,
|
buf->data = mmap(NULL, buf->bytes,
|
||||||
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
if (buf->data == MAP_FAILED) {
|
if (buf->data == MAP_FAILED) {
|
||||||
close(fd);
|
close(fd);
|
||||||
assert(buf->data != MAP_FAILED);
|
test_assert_not_reached("mmap() failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = wl_shm_create_pool(client->wl_shm, fd, buf->bytes);
|
pool = wl_shm_create_pool(client->wl_shm, fd, buf->bytes);
|
||||||
|
|
@ -128,7 +128,7 @@ static void
|
||||||
shm_buffer_destroy(struct shm_buffer *buf)
|
shm_buffer_destroy(struct shm_buffer *buf)
|
||||||
{
|
{
|
||||||
wl_buffer_destroy(buf->proxy);
|
wl_buffer_destroy(buf->proxy);
|
||||||
assert(munmap(buf->data, buf->bytes) == 0);
|
test_assert_int_eq(munmap(buf->data, buf->bytes), 0);
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -199,7 +199,7 @@ rgba4444_create_buffer(struct client *client,
|
||||||
idx = 3;
|
idx = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
buf = shm_buffer_create(client, src.width * src.height * 2, src.width,
|
buf = shm_buffer_create(client, src.width * src.height * 2, src.width,
|
||||||
|
|
@ -248,10 +248,10 @@ rgba5551_create_buffer(struct client *client,
|
||||||
int x, y;
|
int x, y;
|
||||||
uint16_t a;
|
uint16_t a;
|
||||||
|
|
||||||
assert(drm_format == DRM_FORMAT_RGBX5551 ||
|
test_assert_true(drm_format == DRM_FORMAT_RGBX5551 ||
|
||||||
drm_format == DRM_FORMAT_RGBA5551 ||
|
drm_format == DRM_FORMAT_RGBA5551 ||
|
||||||
drm_format == DRM_FORMAT_BGRX5551 ||
|
drm_format == DRM_FORMAT_BGRX5551 ||
|
||||||
drm_format == DRM_FORMAT_BGRA5551);
|
drm_format == DRM_FORMAT_BGRA5551);
|
||||||
|
|
||||||
buf = shm_buffer_create(client, src.width * src.height * 2, src.width,
|
buf = shm_buffer_create(client, src.width * src.height * 2, src.width,
|
||||||
src.height, src.width * 2, drm_format);
|
src.height, src.width * 2, drm_format);
|
||||||
|
|
@ -296,8 +296,8 @@ rgb565_create_buffer(struct client *client,
|
||||||
struct shm_buffer *buf;
|
struct shm_buffer *buf;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
assert(drm_format == DRM_FORMAT_RGB565 ||
|
test_assert_true(drm_format == DRM_FORMAT_RGB565 ||
|
||||||
drm_format == DRM_FORMAT_BGR565);
|
drm_format == DRM_FORMAT_BGR565);
|
||||||
|
|
||||||
buf = shm_buffer_create(client, src.width * src.height * 2, src.width,
|
buf = shm_buffer_create(client, src.width * src.height * 2, src.width,
|
||||||
src.height, src.width * 2, drm_format);
|
src.height, src.width * 2, drm_format);
|
||||||
|
|
@ -336,8 +336,8 @@ rgb888_create_buffer(struct client *client,
|
||||||
struct shm_buffer *buf;
|
struct shm_buffer *buf;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
assert(drm_format == DRM_FORMAT_RGB888 ||
|
test_assert_true(drm_format == DRM_FORMAT_RGB888 ||
|
||||||
drm_format == DRM_FORMAT_BGR888);
|
drm_format == DRM_FORMAT_BGR888);
|
||||||
|
|
||||||
buf = shm_buffer_create(client, src.width * src.height * 3, src.width,
|
buf = shm_buffer_create(client, src.width * src.height * 3, src.width,
|
||||||
src.height, src.width * 3, drm_format);
|
src.height, src.width * 3, drm_format);
|
||||||
|
|
@ -433,7 +433,7 @@ rgba8888_create_buffer(struct client *client,
|
||||||
idx = 3;
|
idx = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
buf = shm_buffer_create(client, src.width * src.height * 4, src.width,
|
buf = shm_buffer_create(client, src.width * src.height * 4, src.width,
|
||||||
|
|
@ -482,10 +482,10 @@ rgba2101010_create_buffer(struct client *client,
|
||||||
int x, y;
|
int x, y;
|
||||||
uint32_t a;
|
uint32_t a;
|
||||||
|
|
||||||
assert(drm_format == DRM_FORMAT_XRGB2101010 ||
|
test_assert_true(drm_format == DRM_FORMAT_XRGB2101010 ||
|
||||||
drm_format == DRM_FORMAT_ARGB2101010 ||
|
drm_format == DRM_FORMAT_ARGB2101010 ||
|
||||||
drm_format == DRM_FORMAT_XBGR2101010 ||
|
drm_format == DRM_FORMAT_XBGR2101010 ||
|
||||||
drm_format == DRM_FORMAT_ABGR2101010);
|
drm_format == DRM_FORMAT_ABGR2101010);
|
||||||
|
|
||||||
buf = shm_buffer_create(client, src.width * src.height * 4, src.width,
|
buf = shm_buffer_create(client, src.width * src.height * 4, src.width,
|
||||||
src.height, src.width * 4, drm_format);
|
src.height, src.width * 4, drm_format);
|
||||||
|
|
@ -558,7 +558,7 @@ rgba16161616_create_buffer(struct client *client,
|
||||||
idx = 1;
|
idx = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
buf = shm_buffer_create(client, src.width * src.height * 8, src.width,
|
buf = shm_buffer_create(client, src.width * src.height * 8, src.width,
|
||||||
|
|
@ -654,7 +654,7 @@ rgba16161616f_create_buffer(struct client *client,
|
||||||
idx = 1;
|
idx = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
buf = shm_buffer_create(client, src.width * src.height * 8, src.width,
|
buf = shm_buffer_create(client, src.width * src.height * 8, src.width,
|
||||||
|
|
@ -739,7 +739,8 @@ x8r8g8b8_to_ycbcr16_bt709(uint32_t xrgb, int depth,
|
||||||
/* Rec. ITU-R BT.709-6 defines D as 1 or 4 for 8-bit or 10-bit
|
/* Rec. ITU-R BT.709-6 defines D as 1 or 4 for 8-bit or 10-bit
|
||||||
* quantization respectively. We extrapolate here to [9, 16]-bit depths
|
* quantization respectively. We extrapolate here to [9, 16]-bit depths
|
||||||
* by setting D to 2^(depth - 8). */
|
* by setting D to 2^(depth - 8). */
|
||||||
assert(depth >= 9 && depth <= 16);
|
test_assert_int_ge(depth, 9);
|
||||||
|
test_assert_int_le(depth, 16);
|
||||||
d = 1 << (depth - 8);
|
d = 1 << (depth - 8);
|
||||||
|
|
||||||
/* normalize to [0.0, 1.0] */
|
/* normalize to [0.0, 1.0] */
|
||||||
|
|
@ -796,10 +797,10 @@ y_u_v_create_buffer(struct client *client,
|
||||||
int sub = (drm_format == DRM_FORMAT_YUV420 ||
|
int sub = (drm_format == DRM_FORMAT_YUV420 ||
|
||||||
drm_format == DRM_FORMAT_YVU420) ? 2 : 1;
|
drm_format == DRM_FORMAT_YVU420) ? 2 : 1;
|
||||||
|
|
||||||
assert(drm_format == DRM_FORMAT_YUV420 ||
|
test_assert_true(drm_format == DRM_FORMAT_YUV420 ||
|
||||||
drm_format == DRM_FORMAT_YVU420 ||
|
drm_format == DRM_FORMAT_YVU420 ||
|
||||||
drm_format == DRM_FORMAT_YUV444 ||
|
drm_format == DRM_FORMAT_YUV444 ||
|
||||||
drm_format == DRM_FORMAT_YVU444);
|
drm_format == DRM_FORMAT_YVU444);
|
||||||
|
|
||||||
/* Full size Y plus quarter U and V */
|
/* Full size Y plus quarter U and V */
|
||||||
bytes = rgb.width * rgb.height +
|
bytes = rgb.width * rgb.height +
|
||||||
|
|
@ -817,7 +818,7 @@ y_u_v_create_buffer(struct client *client,
|
||||||
v_base = y_base + rgb.width * rgb.height;
|
v_base = y_base + rgb.width * rgb.height;
|
||||||
u_base = v_base + (rgb.width / sub) * (rgb.height / sub);
|
u_base = v_base + (rgb.width / sub) * (rgb.height / sub);
|
||||||
} else {
|
} else {
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y = 0; y < rgb.height; y++) {
|
for (y = 0; y < rgb.height; y++) {
|
||||||
|
|
@ -895,7 +896,7 @@ nv12_create_buffer(struct client *client,
|
||||||
idx = 1;
|
idx = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Full size Y, quarter UV */
|
/* Full size Y, quarter UV */
|
||||||
|
|
@ -982,7 +983,7 @@ nv16_create_buffer(struct client *client,
|
||||||
idx = 1;
|
idx = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Full size Y, horizontally subsampled UV */
|
/* Full size Y, horizontally subsampled UV */
|
||||||
|
|
@ -1069,7 +1070,7 @@ nv24_create_buffer(struct client *client,
|
||||||
idx = 1;
|
idx = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Full size Y, non-subsampled UV */
|
/* Full size Y, non-subsampled UV */
|
||||||
|
|
@ -1157,7 +1158,7 @@ yuyv_create_buffer(struct client *client,
|
||||||
idx = 3;
|
idx = 3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Full size Y, horizontally subsampled UV, 2 pixels in 32 bits */
|
/* Full size Y, horizontally subsampled UV, 2 pixels in 32 bits */
|
||||||
|
|
@ -1211,7 +1212,7 @@ xyuv8888_create_buffer(struct client *client,
|
||||||
uint8_t cb;
|
uint8_t cb;
|
||||||
uint8_t y0;
|
uint8_t y0;
|
||||||
|
|
||||||
assert(drm_format == DRM_FORMAT_XYUV8888);
|
test_assert_enum(drm_format, DRM_FORMAT_XYUV8888);
|
||||||
|
|
||||||
/* Full size, 32 bits per pixel */
|
/* Full size, 32 bits per pixel */
|
||||||
bytes = rgb.width * rgb.height * sizeof(uint32_t);
|
bytes = rgb.width * rgb.height * sizeof(uint32_t);
|
||||||
|
|
@ -1290,7 +1291,7 @@ p016_create_buffer(struct client *client,
|
||||||
depth = 10;
|
depth = 10;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0 && "Invalid format!");
|
test_assert_not_reached("Invalid format!");
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Full size Y, quarter UV */
|
/* Full size Y, quarter UV */
|
||||||
|
|
@ -1450,7 +1451,7 @@ TEST_P(shm_buffer, shm_cases)
|
||||||
fname = image_filename("chocolate-cake");
|
fname = image_filename("chocolate-cake");
|
||||||
img = load_image_from_png(fname);
|
img = load_image_from_png(fname);
|
||||||
free(fname);
|
free(fname);
|
||||||
assert(img);
|
test_assert_ptr_not_null(img);
|
||||||
|
|
||||||
client = create_client();
|
client = create_client();
|
||||||
client->surface = create_test_surface(client);
|
client->surface = create_test_surface(client);
|
||||||
|
|
@ -1464,7 +1465,7 @@ TEST_P(shm_buffer, shm_cases)
|
||||||
|
|
||||||
match = verify_screen_content(client, "shm-buffer", my_case->ref_seq_no,
|
match = verify_screen_content(client, "shm-buffer", my_case->ref_seq_no,
|
||||||
NULL, 0, NULL);
|
NULL, 0, NULL);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
shm_buffer_destroy(buf);
|
shm_buffer_destroy(buf);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "single-pixel-buffer-v1-client-protocol.h"
|
#include "single-pixel-buffer-v1-client-protocol.h"
|
||||||
#include "shared/os-compatibility.h"
|
#include "shared/os-compatibility.h"
|
||||||
#include "shared/xalloc.h"
|
#include "shared/xalloc.h"
|
||||||
|
|
@ -92,7 +93,7 @@ TEST(solid_buffer_argb_u32)
|
||||||
0x8fffffff, /* g */
|
0x8fffffff, /* g */
|
||||||
0x4fffffff, /* b */
|
0x4fffffff, /* b */
|
||||||
0xffffffff /* a */);
|
0xffffffff /* a */);
|
||||||
assert(buffer);
|
test_assert_ptr_not_null(buffer);
|
||||||
|
|
||||||
weston_test_move_surface(client->test->weston_test,
|
weston_test_move_surface(client->test->weston_test,
|
||||||
client->surface->wl_surface,
|
client->surface->wl_surface,
|
||||||
|
|
@ -104,7 +105,7 @@ TEST(solid_buffer_argb_u32)
|
||||||
frame_callback_wait(client, &done);
|
frame_callback_wait(client, &done);
|
||||||
|
|
||||||
match = verify_screen_content(client, "single-pixel-buffer", 0, NULL, 0, NULL);
|
match = verify_screen_content(client, "single-pixel-buffer", 0, NULL, 0, NULL);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
wl_buffer_destroy(buffer);
|
wl_buffer_destroy(buffer);
|
||||||
wp_viewport_destroy(viewport);
|
wp_viewport_destroy(viewport);
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "shared/string-helpers.h"
|
#include "shared/string-helpers.h"
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
TEST(strtol_conversions)
|
TEST(strtol_conversions)
|
||||||
{
|
{
|
||||||
|
|
@ -43,46 +43,46 @@ TEST(strtol_conversions)
|
||||||
|
|
||||||
str = ""; val = -1;
|
str = ""; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == false);
|
test_assert_false(ret);
|
||||||
assert(val == -1);
|
test_assert_s32_eq(val, -1);
|
||||||
|
|
||||||
str = "."; val = -1;
|
str = "."; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == false);
|
test_assert_false(ret);
|
||||||
assert(val == -1);
|
test_assert_s32_eq(val, -1);
|
||||||
|
|
||||||
str = "42"; val = -1;
|
str = "42"; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == true);
|
test_assert_true(ret);
|
||||||
assert(val == 42);
|
test_assert_s32_eq(val, 42);
|
||||||
|
|
||||||
str = "-42"; val = -1;
|
str = "-42"; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == true);
|
test_assert_true(ret);
|
||||||
assert(val == -42);
|
test_assert_s32_eq(val, -42);
|
||||||
|
|
||||||
str = "0042"; val = -1;
|
str = "0042"; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == true);
|
test_assert_true(ret);
|
||||||
assert(val == 42);
|
test_assert_s32_eq(val, 42);
|
||||||
|
|
||||||
str = "x42"; val = -1;
|
str = "x42"; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == false);
|
test_assert_false(ret);
|
||||||
assert(val == -1);
|
test_assert_s32_eq(val, -1);
|
||||||
|
|
||||||
str = "42x"; val = -1;
|
str = "42x"; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == false);
|
test_assert_false(ret);
|
||||||
assert(val == -1);
|
test_assert_s32_eq(val, -1);
|
||||||
|
|
||||||
str = "0x42424242"; val = -1;
|
str = "0x42424242"; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == false);
|
test_assert_false(ret);
|
||||||
assert(val == -1);
|
test_assert_s32_eq(val, -1);
|
||||||
|
|
||||||
str = "424748364789L"; val = -1;
|
str = "424748364789L"; val = -1;
|
||||||
ret = safe_strtoint(str, &val);
|
ret = safe_strtoint(str, &val);
|
||||||
assert(ret == false);
|
test_assert_false(ret);
|
||||||
assert(val == -1);
|
test_assert_s32_eq(val, -1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
struct setup_args {
|
struct setup_args {
|
||||||
struct fixture_metadata meta;
|
struct fixture_metadata meta;
|
||||||
|
|
@ -78,18 +79,18 @@ get_subcompositor(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_sub)
|
if (global_sub)
|
||||||
assert(0 && "multiple wl_subcompositor objects");
|
test_assert_not_reached("multiple wl_subcompositor objects");
|
||||||
|
|
||||||
global_sub = g;
|
global_sub = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_sub && "no wl_subcompositor found");
|
test_assert_ptr_not_null(global_sub);
|
||||||
|
|
||||||
assert(global_sub->version == 1);
|
test_assert_u32_eq(global_sub->version, 1);
|
||||||
|
|
||||||
sub = wl_registry_bind(client->wl_registry, global_sub->name,
|
sub = wl_registry_bind(client->wl_registry, global_sub->name,
|
||||||
&wl_subcompositor_interface, 1);
|
&wl_subcompositor_interface, 1);
|
||||||
assert(sub);
|
test_assert_ptr_not_null(sub);
|
||||||
|
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
@ -145,7 +146,7 @@ TEST(subsurface_recursive_unmap)
|
||||||
color_rgb888(&green, 0, 255, 0);
|
color_rgb888(&green, 0, 255, 0);
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 100, 100);
|
client = create_client_and_test_surface(100, 50, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
|
|
||||||
/* move the pointer clearly away from our screenshooting area */
|
/* move the pointer clearly away from our screenshooting area */
|
||||||
|
|
@ -196,7 +197,7 @@ TEST(subsurface_recursive_unmap)
|
||||||
surf[1] = NULL;
|
surf[1] = NULL;
|
||||||
fail += check_screen(client, "subsurface_z_order", 0, &clip, 0);
|
fail += check_screen(client, "subsurface_z_order", 0, &clip, 0);
|
||||||
|
|
||||||
assert(fail == 0);
|
test_assert_int_eq(fail, 0);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(sub); i++)
|
for (i = 0; i < ARRAY_LENGTH(sub); i++)
|
||||||
if (sub[i])
|
if (sub[i])
|
||||||
|
|
@ -235,7 +236,7 @@ TEST(subsurface_z_order)
|
||||||
color_rgb888(&green, 0, 255, 0);
|
color_rgb888(&green, 0, 255, 0);
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 100, 100);
|
client = create_client_and_test_surface(100, 50, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
|
|
||||||
/* move the pointer clearly away from our screenshooting area */
|
/* move the pointer clearly away from our screenshooting area */
|
||||||
|
|
@ -287,7 +288,7 @@ TEST(subsurface_z_order)
|
||||||
|
|
||||||
fail += check_screen(client, "subsurface_z_order", 4, &clip, 4);
|
fail += check_screen(client, "subsurface_z_order", 4, &clip, 4);
|
||||||
|
|
||||||
assert(fail == 0);
|
test_assert_int_eq(fail, 0);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(sub); i++)
|
for (i = 0; i < ARRAY_LENGTH(sub); i++)
|
||||||
if (sub[i])
|
if (sub[i])
|
||||||
|
|
@ -324,7 +325,7 @@ TEST(subsurface_sync_damage_buffer)
|
||||||
color_rgb888(&green, 0, 255, 0);
|
color_rgb888(&green, 0, 255, 0);
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 100, 100);
|
client = create_client_and_test_surface(100, 50, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
|
|
||||||
/* move the pointer clearly away from our screenshooting area */
|
/* move the pointer clearly away from our screenshooting area */
|
||||||
|
|
@ -354,7 +355,7 @@ TEST(subsurface_sync_damage_buffer)
|
||||||
|
|
||||||
fail += check_screen(client, "subsurface_sync_damage_buffer", 2, &clip, 2);
|
fail += check_screen(client, "subsurface_sync_damage_buffer", 2, &clip, 2);
|
||||||
|
|
||||||
assert(fail == 0);
|
test_assert_int_eq(fail, 0);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(sub); i++)
|
for (i = 0; i < ARRAY_LENGTH(sub); i++)
|
||||||
if (sub[i])
|
if (sub[i])
|
||||||
|
|
@ -394,7 +395,7 @@ TEST(subsurface_empty_mapping)
|
||||||
color_rgb888(&green, 0, 255, 0);
|
color_rgb888(&green, 0, 255, 0);
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 100, 100);
|
client = create_client_and_test_surface(100, 50, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
viewporter = bind_to_singleton_global(client,
|
viewporter = bind_to_singleton_global(client,
|
||||||
&wp_viewporter_interface, 1);
|
&wp_viewporter_interface, 1);
|
||||||
|
|
@ -483,7 +484,7 @@ TEST(subsurface_empty_mapping)
|
||||||
|
|
||||||
fail += check_screen(client, "subsurface_empty_mapping", 1, &clip, 11);
|
fail += check_screen(client, "subsurface_empty_mapping", 1, &clip, 11);
|
||||||
|
|
||||||
assert(fail == 0);
|
test_assert_int_eq(fail, 0);
|
||||||
|
|
||||||
wp_viewport_destroy(viewport);
|
wp_viewport_destroy(viewport);
|
||||||
|
|
||||||
|
|
@ -520,7 +521,7 @@ TEST(subsurface_desync_commit)
|
||||||
color_rgb888(&green, 0, 255, 0);
|
color_rgb888(&green, 0, 255, 0);
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 100, 100);
|
client = create_client_and_test_surface(100, 50, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
|
|
||||||
/* make the parent surface red */
|
/* make the parent surface red */
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
#define VERBOSE 0
|
#define VERBOSE 0
|
||||||
|
|
||||||
|
|
@ -67,18 +68,18 @@ get_subcompositor(struct client *client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (global_sub)
|
if (global_sub)
|
||||||
assert(0 && "multiple wl_subcompositor objects");
|
test_assert_not_reached("multiple wl_subcompositor objects");
|
||||||
|
|
||||||
global_sub = g;
|
global_sub = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(global_sub && "no wl_subcompositor found");
|
test_assert_ptr_not_null(global_sub);
|
||||||
|
|
||||||
assert(global_sub->version == 1);
|
test_assert_u32_eq(global_sub->version, 1);
|
||||||
|
|
||||||
sub = wl_registry_bind(client->wl_registry, global_sub->name,
|
sub = wl_registry_bind(client->wl_registry, global_sub->name,
|
||||||
&wl_subcompositor_interface, 1);
|
&wl_subcompositor_interface, 1);
|
||||||
assert(sub);
|
test_assert_ptr_not_null(sub);
|
||||||
|
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +126,7 @@ TEST(test_subsurface_basic_protocol)
|
||||||
struct compound_surface com2;
|
struct compound_surface com2;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com1, client);
|
populate_compound_surface(&com1, client);
|
||||||
populate_compound_surface(&com2, client);
|
populate_compound_surface(&com2, client);
|
||||||
|
|
@ -144,7 +145,7 @@ TEST(test_subsurface_position_protocol)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
for (i = 0; i < NUM_SUBSURFACES; i++)
|
for (i = 0; i < NUM_SUBSURFACES; i++)
|
||||||
|
|
@ -163,7 +164,7 @@ TEST(test_subsurface_placement_protocol)
|
||||||
struct compound_surface com;
|
struct compound_surface com;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -186,7 +187,7 @@ TEST(test_subsurface_paradox)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
parent = wl_compositor_create_surface(client->wl_compositor);
|
parent = wl_compositor_create_surface(client->wl_compositor);
|
||||||
|
|
@ -210,7 +211,7 @@ TEST(test_subsurface_identical_link)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -233,7 +234,7 @@ TEST(test_subsurface_change_link)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
stranger = wl_compositor_create_surface(client->wl_compositor);
|
stranger = wl_compositor_create_surface(client->wl_compositor);
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
@ -258,7 +259,7 @@ TEST(test_subsurface_nesting)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
stranger = wl_compositor_create_surface(client->wl_compositor);
|
stranger = wl_compositor_create_surface(client->wl_compositor);
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
@ -282,7 +283,7 @@ TEST(test_subsurface_nesting_parent)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
stranger = wl_compositor_create_surface(client->wl_compositor);
|
stranger = wl_compositor_create_surface(client->wl_compositor);
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
@ -307,7 +308,7 @@ TEST(test_subsurface_loop_paradox)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
subco = get_subcompositor(client);
|
subco = get_subcompositor(client);
|
||||||
surface[0] = wl_compositor_create_surface(client->wl_compositor);
|
surface[0] = wl_compositor_create_surface(client->wl_compositor);
|
||||||
|
|
@ -340,7 +341,7 @@ TEST(test_subsurface_place_above_nested_parent)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -368,7 +369,7 @@ TEST(test_subsurface_place_above_grandparent)
|
||||||
struct wl_subcompositor *subco;
|
struct wl_subcompositor *subco;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -398,7 +399,7 @@ TEST(test_subsurface_place_above_great_aunt)
|
||||||
struct wl_subcompositor *subco;
|
struct wl_subcompositor *subco;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -428,7 +429,7 @@ TEST(test_subsurface_place_above_child)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -458,7 +459,7 @@ TEST(test_subsurface_place_below_nested_parent)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -486,7 +487,7 @@ TEST(test_subsurface_place_below_grandparent)
|
||||||
struct wl_subcompositor *subco;
|
struct wl_subcompositor *subco;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -516,7 +517,7 @@ TEST(test_subsurface_place_below_great_aunt)
|
||||||
struct wl_subcompositor *subco;
|
struct wl_subcompositor *subco;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -546,7 +547,7 @@ TEST(test_subsurface_place_below_child)
|
||||||
struct wl_subsurface *sub;
|
struct wl_subsurface *sub;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -574,7 +575,7 @@ TEST(test_subsurface_place_above_stranger)
|
||||||
struct wl_surface *stranger;
|
struct wl_surface *stranger;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
stranger = wl_compositor_create_surface(client->wl_compositor);
|
stranger = wl_compositor_create_surface(client->wl_compositor);
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
@ -597,7 +598,7 @@ TEST(test_subsurface_place_below_stranger)
|
||||||
struct wl_surface *stranger;
|
struct wl_surface *stranger;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
stranger = wl_compositor_create_surface(client->wl_compositor);
|
stranger = wl_compositor_create_surface(client->wl_compositor);
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
@ -620,7 +621,7 @@ TEST(test_subsurface_place_above_foreign)
|
||||||
struct compound_surface com2;
|
struct compound_surface com2;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com1, client);
|
populate_compound_surface(&com1, client);
|
||||||
populate_compound_surface(&com2, client);
|
populate_compound_surface(&com2, client);
|
||||||
|
|
@ -643,7 +644,7 @@ TEST(test_subsurface_place_below_foreign)
|
||||||
struct compound_surface com2;
|
struct compound_surface com2;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com1, client);
|
populate_compound_surface(&com1, client);
|
||||||
populate_compound_surface(&com2, client);
|
populate_compound_surface(&com2, client);
|
||||||
|
|
@ -665,7 +666,7 @@ TEST(test_subsurface_destroy_protocol)
|
||||||
struct compound_surface com;
|
struct compound_surface com;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
populate_compound_surface(&com, client);
|
populate_compound_surface(&com, client);
|
||||||
|
|
||||||
|
|
@ -720,7 +721,7 @@ create_subsurface_tree(struct client *client, struct wl_surface **surfs,
|
||||||
|
|
||||||
switch (n) {
|
switch (n) {
|
||||||
default:
|
default:
|
||||||
assert(0);
|
test_assert_not_reached("Unreachable");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#define SUB_LINK(s,p) \
|
#define SUB_LINK(s,p) \
|
||||||
|
|
@ -879,7 +880,7 @@ TEST(test_subsurface_destroy_permutations)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 50, 123, 77);
|
client = create_client_and_test_surface(100, 50, 123, 77);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
permu_init(&per, test_size * 2 - 1);
|
permu_init(&per, test_size * 2 - 1);
|
||||||
while (permu_next(&per) != -1) {
|
while (permu_next(&per) != -1) {
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <libweston/libweston.h>
|
#include <libweston/libweston.h>
|
||||||
#include "libweston-internal.h"
|
#include "libweston-internal.h"
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -54,9 +54,9 @@ PLUGIN_TEST(surface_to_from_global)
|
||||||
struct weston_coord_surface cs;
|
struct weston_coord_surface cs;
|
||||||
|
|
||||||
surface = weston_surface_create(compositor);
|
surface = weston_surface_create(compositor);
|
||||||
assert(surface);
|
test_assert_ptr_not_null(surface);
|
||||||
view = weston_view_create(surface);
|
view = weston_view_create(surface);
|
||||||
assert(view);
|
test_assert_ptr_not_null(view);
|
||||||
surface->width = 50;
|
surface->width = 50;
|
||||||
surface->height = 50;
|
surface->height = 50;
|
||||||
cg.c = weston_coord(5, 10);
|
cg.c = weston_coord(5, 10);
|
||||||
|
|
@ -65,39 +65,49 @@ PLUGIN_TEST(surface_to_from_global)
|
||||||
|
|
||||||
cs = weston_coord_surface(33, 22, surface);
|
cs = weston_coord_surface(33, 22, surface);
|
||||||
cg = weston_coord_surface_to_global(view, cs);
|
cg = weston_coord_surface_to_global(view, cs);
|
||||||
assert(cg.c.x == 38 && cg.c.y == 32);
|
test_assert_f64_eq(cg.c.x, 38);
|
||||||
|
test_assert_f64_eq(cg.c.y, 32);
|
||||||
|
|
||||||
cs = weston_coord_surface(-8, -2, surface);
|
cs = weston_coord_surface(-8, -2, surface);
|
||||||
cg = weston_coord_surface_to_global(view, cs);
|
cg = weston_coord_surface_to_global(view, cs);
|
||||||
assert(cg.c.x == -3 && cg.c.y == 8);
|
test_assert_f64_eq(cg.c.x, -3);
|
||||||
|
test_assert_f64_eq(cg.c.y, 8);
|
||||||
|
|
||||||
cs = weston_coord_surface_from_fixed(wl_fixed_from_int(12),
|
cs = weston_coord_surface_from_fixed(wl_fixed_from_int(12),
|
||||||
wl_fixed_from_int(5), surface);
|
wl_fixed_from_int(5), surface);
|
||||||
cg = weston_coord_surface_to_global(view, cs);
|
cg = weston_coord_surface_to_global(view, cs);
|
||||||
assert(wl_fixed_from_double(cg.c.x) == wl_fixed_from_int(17) &&
|
test_assert_s32_eq(wl_fixed_from_double(cg.c.x),
|
||||||
wl_fixed_from_double(cg.c.y) == wl_fixed_from_int(15));
|
wl_fixed_from_int(17));
|
||||||
|
test_assert_s32_eq(wl_fixed_from_double(cg.c.y),
|
||||||
|
wl_fixed_from_int(15));
|
||||||
|
|
||||||
cg.c = weston_coord(38, 32);
|
cg.c = weston_coord(38, 32);
|
||||||
cs = weston_coord_global_to_surface(view, cg);
|
cs = weston_coord_global_to_surface(view, cg);
|
||||||
assert(cs.c.x == 33 && cs.c.y == 22);
|
test_assert_f64_eq(cs.c.x, 33);
|
||||||
|
test_assert_f64_eq(cs.c.y, 22);
|
||||||
|
|
||||||
cg.c = weston_coord(42, 5);
|
cg.c = weston_coord(42, 5);
|
||||||
cs = weston_coord_global_to_surface(view, cg);
|
cs = weston_coord_global_to_surface(view, cg);
|
||||||
assert(cs.c.x == 37 && cs.c.y == -5);
|
test_assert_f64_eq(cs.c.x, 37);
|
||||||
|
test_assert_f64_eq(cs.c.y, -5);
|
||||||
|
|
||||||
cg.c = weston_coord_from_fixed(wl_fixed_from_int(21),
|
cg.c = weston_coord_from_fixed(wl_fixed_from_int(21),
|
||||||
wl_fixed_from_int(100));
|
wl_fixed_from_int(100));
|
||||||
cs = weston_coord_global_to_surface(view, cg);
|
cs = weston_coord_global_to_surface(view, cg);
|
||||||
assert(wl_fixed_from_double(cs.c.x) == wl_fixed_from_int(16) &&
|
test_assert_s32_eq(wl_fixed_from_double(cs.c.x),
|
||||||
wl_fixed_from_double(cs.c.y) == wl_fixed_from_int(90));
|
wl_fixed_from_int(16));
|
||||||
|
test_assert_s32_eq(wl_fixed_from_double(cs.c.y),
|
||||||
|
wl_fixed_from_int(90));
|
||||||
|
|
||||||
cg.c = weston_coord(0, 0);
|
cg.c = weston_coord(0, 0);
|
||||||
cs = weston_coord_global_to_surface(view, cg);
|
cs = weston_coord_global_to_surface(view, cg);
|
||||||
assert(cs.c.x == -5 && cs.c.y == -10);
|
test_assert_f64_eq(cs.c.x, -5);
|
||||||
|
test_assert_f64_eq(cs.c.y, -10);
|
||||||
|
|
||||||
cg.c = weston_coord(5, 10);
|
cg.c = weston_coord(5, 10);
|
||||||
cs = weston_coord_global_to_surface(view, cg);
|
cs = weston_coord_global_to_surface(view, cg);
|
||||||
assert(cs.c.x == 0 && cs.c.y == 0);
|
test_assert_f64_eq(cs.c.x, 0);
|
||||||
|
test_assert_f64_eq(cs.c.y, 0);
|
||||||
|
|
||||||
/* Destroys all views too. */
|
/* Destroys all views too. */
|
||||||
weston_surface_unref(surface);
|
weston_surface_unref(surface);
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,11 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <libweston/libweston.h>
|
#include <libweston/libweston.h>
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -53,9 +53,9 @@ PLUGIN_TEST(surface_transform)
|
||||||
struct weston_coord_global coord_g;
|
struct weston_coord_global coord_g;
|
||||||
|
|
||||||
surface = weston_surface_create(compositor);
|
surface = weston_surface_create(compositor);
|
||||||
assert(surface);
|
test_assert_ptr_not_null(surface);
|
||||||
view = weston_view_create(surface);
|
view = weston_view_create(surface);
|
||||||
assert(view);
|
test_assert_ptr_not_null(view);
|
||||||
surface->width = 200;
|
surface->width = 200;
|
||||||
surface->height = 200;
|
surface->height = 200;
|
||||||
coord_g.c = weston_coord(100, 100);
|
coord_g.c = weston_coord(100, 100);
|
||||||
|
|
@ -65,14 +65,16 @@ PLUGIN_TEST(surface_transform)
|
||||||
coord_g = weston_coord_surface_to_global(view, coord_s);
|
coord_g = weston_coord_surface_to_global(view, coord_s);
|
||||||
|
|
||||||
fprintf(stderr, "20,20 maps to %f, %f\n", coord_g.c.x, coord_g.c.y);
|
fprintf(stderr, "20,20 maps to %f, %f\n", coord_g.c.x, coord_g.c.y);
|
||||||
assert(coord_g.c.x == 120 && coord_g.c.y == 120);
|
test_assert_f64_eq(coord_g.c.x, 120);
|
||||||
|
test_assert_f64_eq(coord_g.c.y, 120);
|
||||||
|
|
||||||
coord_g.c = weston_coord(150, 300);
|
coord_g.c = weston_coord(150, 300);
|
||||||
weston_view_set_position(view, coord_g);
|
weston_view_set_position(view, coord_g);
|
||||||
weston_view_update_transform(view);
|
weston_view_update_transform(view);
|
||||||
coord_s = weston_coord_surface(50, 40, surface);
|
coord_s = weston_coord_surface(50, 40, surface);
|
||||||
coord_g = weston_coord_surface_to_global(view, coord_s);
|
coord_g = weston_coord_surface_to_global(view, coord_s);
|
||||||
assert(coord_g.c.x == 200 && coord_g.c.y == 340);
|
test_assert_f64_eq(coord_g.c.x, 200);
|
||||||
|
test_assert_f64_eq(coord_g.c.y, 340);
|
||||||
|
|
||||||
/* Destroys all views too. */
|
/* Destroys all views too. */
|
||||||
weston_surface_unref(surface);
|
weston_surface_unref(surface);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "text-input-unstable-v1-client-protocol.h"
|
#include "text-input-unstable-v1-client-protocol.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -188,7 +189,7 @@ TEST(text_test)
|
||||||
struct text_input_state state;
|
struct text_input_state state;
|
||||||
|
|
||||||
client = create_client_and_test_surface(100, 100, 100, 100);
|
client = create_client_and_test_surface(100, 100, 100, 100);
|
||||||
assert(client);
|
test_assert_ptr_not_null(client);
|
||||||
|
|
||||||
factory = NULL;
|
factory = NULL;
|
||||||
wl_list_for_each(global, &client->global_list, link) {
|
wl_list_for_each(global, &client->global_list, link) {
|
||||||
|
|
@ -198,7 +199,7 @@ TEST(text_test)
|
||||||
&zwp_text_input_manager_v1_interface, 1);
|
&zwp_text_input_manager_v1_interface, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(factory);
|
test_assert_ptr_not_null(factory);
|
||||||
|
|
||||||
memset(&state, 0, sizeof state);
|
memset(&state, 0, sizeof state);
|
||||||
text_input = zwp_text_input_manager_v1_create_text_input(factory);
|
text_input = zwp_text_input_manager_v1_create_text_input(factory);
|
||||||
|
|
@ -210,29 +211,33 @@ TEST(text_test)
|
||||||
weston_test_activate_surface(client->test->weston_test,
|
weston_test_activate_surface(client->test->weston_test,
|
||||||
client->surface->wl_surface);
|
client->surface->wl_surface);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(client->input->keyboard->focus == client->surface);
|
test_assert_ptr_eq(client->input->keyboard->focus, client->surface);
|
||||||
|
|
||||||
/* Activate test model and make sure we get enter event. */
|
/* Activate test model and make sure we get enter event. */
|
||||||
zwp_text_input_v1_activate(text_input, client->input->wl_seat,
|
zwp_text_input_v1_activate(text_input, client->input->wl_seat,
|
||||||
client->surface->wl_surface);
|
client->surface->wl_surface);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(state.activated == 1 && state.deactivated == 0);
|
test_assert_int_eq(state.activated, 1);
|
||||||
|
test_assert_int_eq(state.deactivated, 0);
|
||||||
|
|
||||||
/* Deactivate test model and make sure we get leave event. */
|
/* Deactivate test model and make sure we get leave event. */
|
||||||
zwp_text_input_v1_deactivate(text_input, client->input->wl_seat);
|
zwp_text_input_v1_deactivate(text_input, client->input->wl_seat);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(state.activated == 1 && state.deactivated == 1);
|
test_assert_int_eq(state.activated, 1);
|
||||||
|
test_assert_int_eq(state.deactivated, 1);
|
||||||
|
|
||||||
/* Activate test model again. */
|
/* Activate test model again. */
|
||||||
zwp_text_input_v1_activate(text_input, client->input->wl_seat,
|
zwp_text_input_v1_activate(text_input, client->input->wl_seat,
|
||||||
client->surface->wl_surface);
|
client->surface->wl_surface);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(state.activated == 2 && state.deactivated == 1);
|
test_assert_int_eq(state.activated, 2);
|
||||||
|
test_assert_int_eq(state.deactivated, 1);
|
||||||
|
|
||||||
/* Take keyboard focus away and verify we get leave event. */
|
/* Take keyboard focus away and verify we get leave event. */
|
||||||
weston_test_activate_surface(client->test->weston_test, NULL);
|
weston_test_activate_surface(client->test->weston_test, NULL);
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
assert(state.activated == 2 && state.deactivated == 2);
|
test_assert_int_eq(state.activated, 2);
|
||||||
|
test_assert_int_eq(state.deactivated, 2);
|
||||||
|
|
||||||
zwp_text_input_v1_destroy(text_input);
|
zwp_text_input_v1_destroy(text_input);
|
||||||
zwp_text_input_manager_v1_destroy(factory);
|
zwp_text_input_manager_v1_destroy(factory);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "wayland-server-protocol.h"
|
#include "wayland-server-protocol.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -55,7 +56,7 @@ static struct client *
|
||||||
create_touch_test_client(void)
|
create_touch_test_client(void)
|
||||||
{
|
{
|
||||||
struct client *cl = create_client_and_test_surface(0, 0, 100, 100);
|
struct client *cl = create_client_and_test_surface(0, 0, 100, 100);
|
||||||
assert(cl);
|
test_assert_ptr_not_null(cl);
|
||||||
return cl;
|
return cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -112,16 +113,16 @@ TEST(touch_events)
|
||||||
input_timestamps_create_for_touch(client);
|
input_timestamps_create_for_touch(client);
|
||||||
|
|
||||||
send_touch(client, &t1, WL_TOUCH_DOWN);
|
send_touch(client, &t1, WL_TOUCH_DOWN);
|
||||||
assert(touch->down_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(touch->down_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&touch->down_time_timespec, &t1));
|
test_assert_true(timespec_eq(&touch->down_time_timespec, &t1));
|
||||||
|
|
||||||
send_touch(client, &t2, WL_TOUCH_MOTION);
|
send_touch(client, &t2, WL_TOUCH_MOTION);
|
||||||
assert(touch->motion_time_msec == timespec_to_msec(&t2));
|
test_assert_s64_eq(touch->motion_time_msec, timespec_to_msec(&t2));
|
||||||
assert(timespec_eq(&touch->motion_time_timespec, &t2));
|
test_assert_true(timespec_eq(&touch->motion_time_timespec, &t2));
|
||||||
|
|
||||||
send_touch(client, &t3, WL_TOUCH_UP);
|
send_touch(client, &t3, WL_TOUCH_UP);
|
||||||
assert(touch->up_time_msec == timespec_to_msec(&t3));
|
test_assert_s64_eq(touch->up_time_msec, timespec_to_msec(&t3));
|
||||||
assert(timespec_eq(&touch->up_time_timespec, &t3));
|
test_assert_true(timespec_eq(&touch->up_time_timespec, &t3));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
|
|
@ -136,14 +137,14 @@ TEST(touch_timestamps_stop_after_input_timestamps_object_is_destroyed)
|
||||||
input_timestamps_create_for_touch(client);
|
input_timestamps_create_for_touch(client);
|
||||||
|
|
||||||
send_touch(client, &t1, WL_TOUCH_DOWN);
|
send_touch(client, &t1, WL_TOUCH_DOWN);
|
||||||
assert(touch->down_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(touch->down_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&touch->down_time_timespec, &t1));
|
test_assert_true(timespec_eq(&touch->down_time_timespec, &t1));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
send_touch(client, &t2, WL_TOUCH_UP);
|
send_touch(client, &t2, WL_TOUCH_UP);
|
||||||
assert(touch->up_time_msec == timespec_to_msec(&t2));
|
test_assert_s64_eq(touch->up_time_msec, timespec_to_msec(&t2));
|
||||||
assert(timespec_is_zero(&touch->up_time_timespec));
|
test_assert_true(timespec_is_zero(&touch->up_time_timespec));
|
||||||
|
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
}
|
}
|
||||||
|
|
@ -156,8 +157,8 @@ TEST(touch_timestamps_stop_after_client_releases_wl_touch)
|
||||||
input_timestamps_create_for_touch(client);
|
input_timestamps_create_for_touch(client);
|
||||||
|
|
||||||
send_touch(client, &t1, WL_TOUCH_DOWN);
|
send_touch(client, &t1, WL_TOUCH_DOWN);
|
||||||
assert(touch->down_time_msec == timespec_to_msec(&t1));
|
test_assert_s64_eq(touch->down_time_msec, timespec_to_msec(&t1));
|
||||||
assert(timespec_eq(&touch->down_time_timespec, &t1));
|
test_assert_true(timespec_eq(&touch->down_time_timespec, &t1));
|
||||||
|
|
||||||
wl_touch_release(client->input->touch->wl_touch);
|
wl_touch_release(client->input->touch->wl_touch);
|
||||||
|
|
||||||
|
|
@ -168,7 +169,7 @@ TEST(touch_timestamps_stop_after_client_releases_wl_touch)
|
||||||
* event and checking for it here may lead to false negatives. */
|
* event and checking for it here may lead to false negatives. */
|
||||||
touch->input_timestamp = t_other;
|
touch->input_timestamp = t_other;
|
||||||
send_touch(client, &t2, WL_TOUCH_UP);
|
send_touch(client, &t2, WL_TOUCH_UP);
|
||||||
assert(timespec_eq(&touch->input_timestamp, &t_other));
|
test_assert_true(timespec_eq(&touch->input_timestamp, &t_other));
|
||||||
|
|
||||||
input_timestamps_destroy(input_ts);
|
input_timestamps_destroy(input_ts);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "vertex-clipping.h"
|
#include "vertex-clipping.h"
|
||||||
|
|
||||||
#define BOX(x1,y1,x2,y2) { { x1, y1 }, { x2, y2 } }
|
#define BOX(x1,y1,x2,y2) { { x1, y1 }, { x2, y2 } }
|
||||||
|
|
@ -59,7 +60,7 @@ assert_vertices(const struct clipper_vertex *clipped, int clipped_n,
|
||||||
int first, i, j;
|
int first, i, j;
|
||||||
|
|
||||||
/* Is the number of clipped vertices correct? */
|
/* Is the number of clipped vertices correct? */
|
||||||
assert(clipped_n == expected_n);
|
test_assert_int_eq(clipped_n, expected_n);
|
||||||
|
|
||||||
for (first = 0; first < clipped_n; first++)
|
for (first = 0; first < clipped_n; first++)
|
||||||
if (clipper_float_difference(clipped[first].x, expected[0].x) == 0.0f &&
|
if (clipper_float_difference(clipped[first].x, expected[0].x) == 0.0f &&
|
||||||
|
|
@ -67,13 +68,13 @@ assert_vertices(const struct clipper_vertex *clipped, int clipped_n,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Have we found the first expected vertex? */
|
/* Have we found the first expected vertex? */
|
||||||
assert(!clipped_n || first != clipped_n);
|
test_assert_true(!clipped_n || first != clipped_n);
|
||||||
|
|
||||||
/* Do the remaining vertices match? */
|
/* Do the remaining vertices match? */
|
||||||
for (i = 1; i < clipped_n; i++) {
|
for (i = 1; i < clipped_n; i++) {
|
||||||
j = (i + first) % clipped_n;
|
j = (i + first) % clipped_n;
|
||||||
assert(clipper_float_difference(clipped[j].x, expected[i].x) == 0.0f &&
|
test_assert_f32_eq(clipper_float_difference(clipped[j].x, expected[i].x), 0.0f);
|
||||||
clipper_float_difference(clipped[j].y, expected[i].y) == 0.0f);
|
test_assert_f32_eq(clipper_float_difference(clipped[j].y, expected[i].y), 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -762,10 +763,10 @@ TEST_P(quad_clip_box32_expected, quad_clip_box32_expected_data)
|
||||||
|
|
||||||
TEST(float_difference_different)
|
TEST(float_difference_different)
|
||||||
{
|
{
|
||||||
assert(clipper_float_difference(1.0f, 0.0f) == 1.0f);
|
test_assert_f32_eq(clipper_float_difference(1.0f, 0.0f), 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(float_difference_same)
|
TEST(float_difference_same)
|
||||||
{
|
{
|
||||||
assert(clipper_float_difference(1.0f, 1.0f) == 0.0f);
|
test_assert_f32_eq(clipper_float_difference(1.0f, 1.0f), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
struct setup_args {
|
struct setup_args {
|
||||||
struct fixture_metadata meta;
|
struct fixture_metadata meta;
|
||||||
|
|
@ -93,7 +94,7 @@ TEST(viewport_upscale_solid)
|
||||||
|
|
||||||
match = verify_screen_content(client, "viewport_upscale_solid", 0,
|
match = verify_screen_content(client, "viewport_upscale_solid", 0,
|
||||||
NULL, 0, NULL);
|
NULL, 0, NULL);
|
||||||
assert(match);
|
test_assert_true(match);
|
||||||
|
|
||||||
wp_viewport_destroy(viewport);
|
wp_viewport_destroy(viewport);
|
||||||
client_destroy(client);
|
client_destroy(client);
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,13 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "shared/helpers.h"
|
#include "shared/helpers.h"
|
||||||
#include "shared/xalloc.h"
|
#include "shared/xalloc.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
fixture_setup(struct weston_test_harness *harness)
|
fixture_setup(struct weston_test_harness *harness)
|
||||||
|
|
@ -316,20 +316,20 @@ TEST(test_viewporter_source_buffer_params)
|
||||||
const int max_scale = 2;
|
const int max_scale = 2;
|
||||||
|
|
||||||
/* buffer_scale requirement */
|
/* buffer_scale requirement */
|
||||||
assert(WIN_W % max_scale == 0);
|
test_assert_int_eq(WIN_W % max_scale, 0);
|
||||||
assert(WIN_H % max_scale == 0);
|
test_assert_int_eq(WIN_H % max_scale, 0);
|
||||||
|
|
||||||
/* source rect must fit inside regardless of scale and transform */
|
/* source rect must fit inside regardless of scale and transform */
|
||||||
assert(SRC_W < WIN_W / max_scale);
|
test_assert_int_lt(SRC_W, WIN_W / max_scale);
|
||||||
assert(SRC_H < WIN_H / max_scale);
|
test_assert_int_lt(SRC_H, WIN_H / max_scale);
|
||||||
assert(SRC_W < WIN_H / max_scale);
|
test_assert_int_lt(SRC_W, WIN_H / max_scale);
|
||||||
assert(SRC_H < WIN_W / max_scale);
|
test_assert_int_lt(SRC_H, WIN_W / max_scale);
|
||||||
|
|
||||||
/* If buffer scale was ignored, source rect should be inside instead */
|
/* If buffer scale was ignored, source rect should be inside instead */
|
||||||
assert(WIN_W / max_scale + SRC_W + MRG < WIN_W);
|
test_assert_int_lt(WIN_W / max_scale + SRC_W + MRG, WIN_W);
|
||||||
assert(WIN_H / max_scale + SRC_H + MRG < WIN_H);
|
test_assert_int_lt(WIN_H / max_scale + SRC_H + MRG, WIN_H);
|
||||||
assert(WIN_W / max_scale + SRC_H + MRG < WIN_W);
|
test_assert_int_lt(WIN_W / max_scale + SRC_H + MRG, WIN_W);
|
||||||
assert(WIN_H / max_scale + SRC_W + MRG < WIN_H);
|
test_assert_int_lt(WIN_H / max_scale + SRC_W + MRG, WIN_H);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct source_buffer_args bad_source_buffer_args[] = {
|
static const struct source_buffer_args bad_source_buffer_args[] = {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@
|
||||||
#include "shared/xalloc.h"
|
#include "shared/xalloc.h"
|
||||||
#include <libweston/zalloc.h>
|
#include <libweston/zalloc.h>
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "image-iter.h"
|
#include "image-iter.h"
|
||||||
#include "weston-output-capture-client-protocol.h"
|
#include "weston-output-capture-client-protocol.h"
|
||||||
|
|
||||||
|
|
@ -498,12 +499,12 @@ create_shm_buffer(struct client *client, int width, int height,
|
||||||
size_t bytes_pp;
|
size_t bytes_pp;
|
||||||
uint32_t shm_format;
|
uint32_t shm_format;
|
||||||
|
|
||||||
assert(width > 0);
|
test_assert_int_gt(width, 0);
|
||||||
assert(height > 0);
|
test_assert_int_gt(height, 0);
|
||||||
|
|
||||||
pfmt = pixel_format_get_info(drm_format);
|
pfmt = pixel_format_get_info(drm_format);
|
||||||
assert(pfmt);
|
test_assert_ptr_not_null(pfmt);
|
||||||
assert(pixel_format_get_plane_count(pfmt) == 1);
|
test_assert_uint_eq(pixel_format_get_plane_count(pfmt), 1);
|
||||||
shm_format = pixel_format_get_shm_format(pfmt);
|
shm_format = pixel_format_get_shm_format(pfmt);
|
||||||
|
|
||||||
if (!support_shm_format(client, shm_format))
|
if (!support_shm_format(client, shm_format))
|
||||||
|
|
@ -515,18 +516,18 @@ create_shm_buffer(struct client *client, int width, int height,
|
||||||
stride_bytes = width * bytes_pp;
|
stride_bytes = width * bytes_pp;
|
||||||
/* round up to multiple of 4 bytes for Pixman */
|
/* round up to multiple of 4 bytes for Pixman */
|
||||||
stride_bytes = (stride_bytes + 3) & ~3u;
|
stride_bytes = (stride_bytes + 3) & ~3u;
|
||||||
assert(stride_bytes / bytes_pp >= (unsigned)width);
|
test_assert_u64_ge(stride_bytes / bytes_pp, width);
|
||||||
|
|
||||||
buf->len = stride_bytes * height;
|
buf->len = stride_bytes * height;
|
||||||
assert(buf->len / stride_bytes == (unsigned)height);
|
test_assert_u64_eq(buf->len / stride_bytes, height);
|
||||||
|
|
||||||
fd = os_create_anonymous_file(buf->len);
|
fd = os_create_anonymous_file(buf->len);
|
||||||
assert(fd >= 0);
|
test_assert_int_ge(fd, 0);
|
||||||
|
|
||||||
data = mmap(NULL, buf->len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
data = mmap(NULL, buf->len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
if (data == MAP_FAILED) {
|
if (data == MAP_FAILED) {
|
||||||
close(fd);
|
close(fd);
|
||||||
assert(data != MAP_FAILED);
|
test_assert_not_reached("Unreachable");
|
||||||
}
|
}
|
||||||
|
|
||||||
pool = wl_shm_create_pool(shm, fd, buf->len);
|
pool = wl_shm_create_pool(shm, fd, buf->len);
|
||||||
|
|
@ -540,8 +541,8 @@ create_shm_buffer(struct client *client, int width, int height,
|
||||||
width, height,
|
width, height,
|
||||||
data, stride_bytes);
|
data, stride_bytes);
|
||||||
|
|
||||||
assert(buf->proxy);
|
test_assert_ptr_not_null(buf->proxy);
|
||||||
assert(buf->image);
|
test_assert_ptr_not_null(buf->image);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
@ -557,13 +558,13 @@ create_pixman_buffer(int width, int height, pixman_format_code_t pixman_format)
|
||||||
{
|
{
|
||||||
struct buffer *buf;
|
struct buffer *buf;
|
||||||
|
|
||||||
assert(width > 0);
|
test_assert_int_gt(width, 0);
|
||||||
assert(height > 0);
|
test_assert_int_gt(height, 0);
|
||||||
|
|
||||||
buf = xzalloc(sizeof *buf);
|
buf = xzalloc(sizeof *buf);
|
||||||
buf->image = pixman_image_create_bits(pixman_format,
|
buf->image = pixman_image_create_bits(pixman_format,
|
||||||
width, height, NULL, 0);
|
width, height, NULL, 0);
|
||||||
assert(buf->image);
|
test_assert_ptr_not_null(buf->image);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
@ -577,10 +578,10 @@ buffer_destroy(struct buffer *buf)
|
||||||
|
|
||||||
if (buf->proxy) {
|
if (buf->proxy) {
|
||||||
wl_buffer_destroy(buf->proxy);
|
wl_buffer_destroy(buf->proxy);
|
||||||
assert(munmap(pixels, buf->len) == 0);
|
test_assert_int_eq(munmap(pixels, buf->len), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(pixman_image_unref(buf->image));
|
test_assert_true(pixman_image_unref(buf->image));
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
@ -710,12 +711,12 @@ seat_handle_name(void *data, struct wl_seat *seat, const char *name)
|
||||||
struct input *input = data;
|
struct input *input = data;
|
||||||
|
|
||||||
input->seat_name = strdup(name);
|
input->seat_name = strdup(name);
|
||||||
assert(input->seat_name && "No memory");
|
test_assert_ptr_not_null(input->seat_name);
|
||||||
|
|
||||||
/* We only update the devices and set client input for the test seat */
|
/* We only update the devices and set client input for the test seat */
|
||||||
if (strcmp(name, "test-seat") == 0) {
|
if (strcmp(name, "test-seat") == 0) {
|
||||||
assert(!input->client->input &&
|
/* Can't have multiple test seats. */
|
||||||
"Multiple test seats detected!");
|
test_assert_ptr_null(input->client->input);
|
||||||
|
|
||||||
input_update_devices(input);
|
input_update_devices(input);
|
||||||
input->client->input = input;
|
input->client->input = input;
|
||||||
|
|
@ -807,7 +808,7 @@ static const struct wl_output_listener output_listener = {
|
||||||
static void
|
static void
|
||||||
output_destroy(struct output *output)
|
output_destroy(struct output *output)
|
||||||
{
|
{
|
||||||
assert(wl_proxy_get_version((struct wl_proxy *)output->wl_output) >= 3);
|
test_assert_u32_ge(wl_proxy_get_version((struct wl_proxy *)output->wl_output), 3);
|
||||||
wl_output_release(output->wl_output);
|
wl_output_release(output->wl_output);
|
||||||
wl_list_remove(&output->link);
|
wl_list_remove(&output->link);
|
||||||
free(output->name);
|
free(output->name);
|
||||||
|
|
@ -828,7 +829,7 @@ handle_global(void *data, struct wl_registry *registry,
|
||||||
global = xzalloc(sizeof *global);
|
global = xzalloc(sizeof *global);
|
||||||
global->name = id;
|
global->name = id;
|
||||||
global->interface = strdup(interface);
|
global->interface = strdup(interface);
|
||||||
assert(interface);
|
test_assert_ptr_not_null(interface);
|
||||||
global->version = version;
|
global->version = version;
|
||||||
wl_list_insert(client->global_list.prev, &global->link);
|
wl_list_insert(client->global_list.prev, &global->link);
|
||||||
|
|
||||||
|
|
@ -918,7 +919,9 @@ handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
|
||||||
struct input *input;
|
struct input *input;
|
||||||
|
|
||||||
global = client_find_global_with_name(client, name);
|
global = client_find_global_with_name(client, name);
|
||||||
assert(global && "Request to remove unknown global");
|
|
||||||
|
/* Unknown global. */
|
||||||
|
test_assert_ptr_not_null(global);
|
||||||
|
|
||||||
if (strcmp(global->interface, "wl_seat") == 0) {
|
if (strcmp(global->interface, "wl_seat") == 0) {
|
||||||
input = client_find_input_with_name(client, name);
|
input = client_find_input_with_name(client, name);
|
||||||
|
|
@ -971,8 +974,11 @@ expect_protocol_error(struct client *client,
|
||||||
|
|
||||||
err = wl_display_get_error(client->wl_display);
|
err = wl_display_get_error(client->wl_display);
|
||||||
|
|
||||||
assert(err && "Expected protocol error but nothing came");
|
/* Expected protocol error but nothing came. */
|
||||||
assert(err == EPROTO && "Expected protocol error but got local error");
|
test_assert_int_ne(err, 0);
|
||||||
|
|
||||||
|
/* Expected protocol error but got local error. */
|
||||||
|
test_assert_enum(err, EPROTO);
|
||||||
|
|
||||||
errcode = wl_display_get_protocol_error(client->wl_display,
|
errcode = wl_display_get_protocol_error(client->wl_display,
|
||||||
&interface, &id);
|
&interface, &id);
|
||||||
|
|
@ -1030,7 +1036,7 @@ create_client(void)
|
||||||
/* connect to display */
|
/* connect to display */
|
||||||
client = xzalloc(sizeof *client);
|
client = xzalloc(sizeof *client);
|
||||||
client->wl_display = wl_display_connect(NULL);
|
client->wl_display = wl_display_connect(NULL);
|
||||||
assert(client->wl_display);
|
test_assert_ptr_not_null(client->wl_display);
|
||||||
wl_array_init(&client->shm_formats);
|
wl_array_init(&client->shm_formats);
|
||||||
wl_list_init(&client->global_list);
|
wl_list_init(&client->global_list);
|
||||||
wl_list_init(&client->inputs);
|
wl_list_init(&client->inputs);
|
||||||
|
|
@ -1048,20 +1054,20 @@ create_client(void)
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
/* must have WL_SHM_FORMAT_*RGB8888 */
|
/* must have WL_SHM_FORMAT_*RGB8888 */
|
||||||
assert(support_shm_format(client, WL_SHM_FORMAT_ARGB8888));
|
test_assert_true(support_shm_format(client, WL_SHM_FORMAT_ARGB8888));
|
||||||
assert(support_shm_format(client, WL_SHM_FORMAT_XRGB8888));
|
test_assert_true(support_shm_format(client, WL_SHM_FORMAT_XRGB8888));
|
||||||
|
|
||||||
/* must have weston_test interface */
|
/* must have weston_test interface */
|
||||||
assert(client->test);
|
test_assert_ptr_not_null(client->test);
|
||||||
|
|
||||||
/* must have an output */
|
/* must have an output */
|
||||||
assert(client->output);
|
test_assert_ptr_not_null(client->output);
|
||||||
|
|
||||||
/* the output must be initialized */
|
/* the output must be initialized */
|
||||||
assert(client->output->initialized == 1);
|
test_assert_int_eq(client->output->initialized, 1);
|
||||||
|
|
||||||
/* must have seat set */
|
/* must have seat set */
|
||||||
assert(client->input);
|
test_assert_ptr_not_null(client->input);
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
@ -1076,7 +1082,7 @@ create_test_surface(struct client *client)
|
||||||
surface->client = client;
|
surface->client = client;
|
||||||
surface->wl_surface =
|
surface->wl_surface =
|
||||||
wl_compositor_create_surface(client->wl_compositor);
|
wl_compositor_create_surface(client->wl_compositor);
|
||||||
assert(surface->wl_surface);
|
test_assert_ptr_not_null(surface->wl_surface);
|
||||||
|
|
||||||
wl_surface_add_listener(surface->wl_surface, &surface_listener,
|
wl_surface_add_listener(surface->wl_surface, &surface_listener,
|
||||||
surface);
|
surface);
|
||||||
|
|
@ -1180,7 +1186,7 @@ client_destroy(struct client *client)
|
||||||
|
|
||||||
if (client->wl_display) {
|
if (client->wl_display) {
|
||||||
ret = wl_display_roundtrip(client->wl_display);
|
ret = wl_display_roundtrip(client->wl_display);
|
||||||
assert(client->errored_ok || ret >= 0);
|
test_assert_true(client->errored_ok || ret >= 0);
|
||||||
wl_display_disconnect(client->wl_display);
|
wl_display_disconnect(client->wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1223,9 +1229,11 @@ char *
|
||||||
image_filename(const char *basename)
|
image_filename(const char *basename)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = asprintf(&filename, "%s/%s.png", reference_path(), basename);
|
||||||
|
test_assert_int_ge(ret, 0);
|
||||||
|
|
||||||
if (asprintf(&filename, "%s/%s.png", reference_path(), basename) < 0)
|
|
||||||
assert(0);
|
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1243,8 +1251,8 @@ output_filename_for_test_program(const char *test_program, const char *suffix,
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
assert(test_program);
|
test_assert_ptr_not_null(test_program);
|
||||||
assert(file_ext);
|
test_assert_ptr_not_null(file_ext);
|
||||||
|
|
||||||
if (suffix)
|
if (suffix)
|
||||||
str_printf(&filename, "%s/%s-%s.%s", output_path(), test_program,
|
str_printf(&filename, "%s/%s-%s.%s", output_path(), test_program,
|
||||||
|
|
@ -1253,7 +1261,7 @@ output_filename_for_test_program(const char *test_program, const char *suffix,
|
||||||
str_printf(&filename, "%s/%s.%s", output_path(), test_program,
|
str_printf(&filename, "%s/%s.%s", output_path(), test_program,
|
||||||
file_ext);
|
file_ext);
|
||||||
|
|
||||||
assert(filename);
|
test_assert_ptr_not_null(filename);
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1274,9 +1282,9 @@ output_filename_for_fixture(const char *test_program,
|
||||||
int fixture_number;
|
int fixture_number;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
assert(test_program);
|
test_assert_ptr_not_null(test_program);
|
||||||
assert(harness);
|
test_assert_ptr_not_null(harness);
|
||||||
assert(file_ext);
|
test_assert_ptr_not_null(file_ext);
|
||||||
|
|
||||||
fixture_number = get_test_fixture_number_from_harness(harness);
|
fixture_number = get_test_fixture_number_from_harness(harness);
|
||||||
|
|
||||||
|
|
@ -1287,7 +1295,7 @@ output_filename_for_fixture(const char *test_program,
|
||||||
str_printf(&filename, "%s/%s-f%02d.%s", output_path(), test_program,
|
str_printf(&filename, "%s/%s-f%02d.%s", output_path(), test_program,
|
||||||
fixture_number, file_ext);
|
fixture_number, file_ext);
|
||||||
|
|
||||||
assert(filename);
|
test_assert_ptr_not_null(filename);
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1309,7 +1317,7 @@ output_filename_for_test_case(const char *suffix, uint32_t seq_number,
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
assert(file_ext);
|
test_assert_ptr_not_null(file_ext);
|
||||||
|
|
||||||
if (suffix)
|
if (suffix)
|
||||||
str_printf(&filename, "%s/%s-%s-%02d.%s", output_path(), get_test_name(),
|
str_printf(&filename, "%s/%s-%s-%02d.%s", output_path(), get_test_name(),
|
||||||
|
|
@ -1318,7 +1326,7 @@ output_filename_for_test_case(const char *suffix, uint32_t seq_number,
|
||||||
str_printf(&filename, "%s/%s-%02d.%s", output_path(), get_test_name(),
|
str_printf(&filename, "%s/%s-%02d.%s", output_path(), get_test_name(),
|
||||||
seq_number, file_ext);
|
seq_number, file_ext);
|
||||||
|
|
||||||
assert(filename);
|
test_assert_ptr_not_null(filename);
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1373,7 +1381,9 @@ format_cairo2pixman(cairo_format_t fmt)
|
||||||
if (format_map[i].cairo == fmt)
|
if (format_map[i].cairo == fmt)
|
||||||
return format_map[i].pixman;
|
return format_map[i].pixman;
|
||||||
|
|
||||||
assert(0 && "unknown Cairo pixel format");
|
test_assert_not_reached("unknown Cairo pixel format");
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_format_t
|
static cairo_format_t
|
||||||
|
|
@ -1385,7 +1395,9 @@ format_pixman2cairo(pixman_format_code_t fmt)
|
||||||
if (format_map[i].pixman == fmt)
|
if (format_map[i].pixman == fmt)
|
||||||
return format_map[i].cairo;
|
return format_map[i].cairo;
|
||||||
|
|
||||||
assert(0 && "unknown Pixman pixel format");
|
test_assert_not_reached("unknown Pixman pixel format");
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1402,7 +1414,7 @@ range_get(const struct range *r)
|
||||||
if (!r)
|
if (!r)
|
||||||
return (struct range){ 0, 0 };
|
return (struct range){ 0, 0 };
|
||||||
|
|
||||||
assert(r->a <= r->b);
|
test_assert_int_le(r->a, r->b);
|
||||||
return *r;
|
return *r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1442,14 +1454,14 @@ image_check_get_roi(const struct image_header *ih_a,
|
||||||
box.y2 = max(ih_a->height, ih_b->height);
|
box.y2 = max(ih_a->height, ih_b->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(box.x1 >= 0);
|
test_assert_s32_ge(box.x1, 0);
|
||||||
assert(box.y1 >= 0);
|
test_assert_s32_ge(box.y1, 0);
|
||||||
assert(box.x2 > box.x1);
|
test_assert_s32_gt(box.x2, box.x1);
|
||||||
assert(box.y2 > box.y1);
|
test_assert_s32_gt(box.y2, box.y1);
|
||||||
assert(box.x2 <= ih_a->width);
|
test_assert_s32_le(box.x2, ih_a->width);
|
||||||
assert(box.x2 <= ih_b->width);
|
test_assert_s32_le(box.x2, ih_b->width);
|
||||||
assert(box.y2 <= ih_a->height);
|
test_assert_s32_le(box.y2, ih_a->height);
|
||||||
assert(box.y2 <= ih_b->height);
|
test_assert_s32_le(box.y2, ih_b->height);
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
}
|
}
|
||||||
|
|
@ -1703,7 +1715,7 @@ image_convert_to_a8r8g8b8(pixman_image_t *image)
|
||||||
|
|
||||||
ret = pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8,
|
ret = pixman_image_create_bits_no_clear(PIXMAN_a8r8g8b8,
|
||||||
ih.width, ih.height, NULL, 0);
|
ih.width, ih.height, NULL, 0);
|
||||||
assert(ret);
|
test_assert_ptr_not_null(ret);
|
||||||
|
|
||||||
pixman_image_composite32(PIXMAN_OP_SRC, image, NULL, ret,
|
pixman_image_composite32(PIXMAN_OP_SRC, image, NULL, ret,
|
||||||
0, 0, 0, 0, 0, 0, ih.width, ih.height);
|
0, 0, 0, 0, 0, 0, ih.width, ih.height);
|
||||||
|
|
@ -1764,7 +1776,7 @@ load_image_from_png(const char *fname)
|
||||||
/* The Cairo surface will own the data, so we keep it around. */
|
/* The Cairo surface will own the data, so we keep it around. */
|
||||||
image = pixman_image_create_bits_no_clear(pixman_fmt,
|
image = pixman_image_create_bits_no_clear(pixman_fmt,
|
||||||
width, height, data, stride);
|
width, height, data, stride);
|
||||||
assert(image);
|
test_assert_ptr_not_null(image);
|
||||||
|
|
||||||
pixman_image_set_destroy_function(image, destroy_cairo_surface,
|
pixman_image_set_destroy_function(image, destroy_cairo_surface,
|
||||||
reference_cairo_surface);
|
reference_cairo_surface);
|
||||||
|
|
@ -1820,7 +1832,7 @@ static void
|
||||||
output_capturer_handle_retry(void *data,
|
output_capturer_handle_retry(void *data,
|
||||||
struct weston_capture_source_v1 *proxy)
|
struct weston_capture_source_v1 *proxy)
|
||||||
{
|
{
|
||||||
assert(0 && "output capture retry in tests indicates a race");
|
test_assert_not_reached("output capture retry in tests indicates a race");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1829,7 +1841,8 @@ output_capturer_handle_failed(void *data,
|
||||||
const char *msg)
|
const char *msg)
|
||||||
{
|
{
|
||||||
testlog("output capture failed: %s", msg ? msg : "?");
|
testlog("output capture failed: %s", msg ? msg : "?");
|
||||||
assert(0 && "output capture failed");
|
|
||||||
|
test_assert_not_reached("output capture failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct weston_capture_source_v1_listener output_capturer_source_handlers = {
|
static const struct weston_capture_source_v1_listener output_capturer_source_handlers = {
|
||||||
|
|
@ -1860,15 +1873,17 @@ client_capture_output(struct client *client,
|
||||||
|
|
||||||
client_roundtrip(client);
|
client_roundtrip(client);
|
||||||
|
|
||||||
assert(capt.width != 0 && capt.height != 0 && capt.drm_format != 0 &&
|
test_assert_true(capt.width != 0 &&
|
||||||
"capture source not available");
|
capt.height != 0 &&
|
||||||
|
capt.drm_format != 0 &&
|
||||||
|
"capture source not available");
|
||||||
|
|
||||||
buf = create_shm_buffer(client,
|
buf = create_shm_buffer(client,
|
||||||
capt.width, capt.height, capt.drm_format);
|
capt.width, capt.height, capt.drm_format);
|
||||||
|
|
||||||
weston_capture_source_v1_capture(capt.source, buf->proxy);
|
weston_capture_source_v1_capture(capt.source, buf->proxy);
|
||||||
while (!capt.complete)
|
while (!capt.complete)
|
||||||
assert(wl_display_dispatch(client->wl_display) >= 0);
|
test_assert_int_ge(wl_display_dispatch(client->wl_display), 0);
|
||||||
|
|
||||||
weston_capture_source_v1_destroy(capt.source);
|
weston_capture_source_v1_destroy(capt.source);
|
||||||
weston_capture_v1_destroy(capt.factory);
|
weston_capture_v1_destroy(capt.factory);
|
||||||
|
|
@ -1912,7 +1927,7 @@ capture_screenshot_of_output(struct client *client, const char *output_name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(output);
|
test_assert_ptr_not_null(output);
|
||||||
} else {
|
} else {
|
||||||
output = client->output;
|
output = client->output;
|
||||||
}
|
}
|
||||||
|
|
@ -2049,7 +2064,7 @@ verify_screen_content(struct client *client,
|
||||||
bool match;
|
bool match;
|
||||||
|
|
||||||
shot = capture_screenshot_of_output(client, output_name);
|
shot = capture_screenshot_of_output(client, output_name);
|
||||||
assert(shot);
|
test_assert_ptr_not_null(shot);
|
||||||
match = verify_image(shot->image, ref_image, ref_seq_no, clip, seq_no);
|
match = verify_image(shot->image, ref_image, ref_seq_no, clip, seq_no);
|
||||||
buffer_destroy(shot);
|
buffer_destroy(shot);
|
||||||
|
|
||||||
|
|
@ -2078,12 +2093,12 @@ client_buffer_from_image_file(struct client *client,
|
||||||
int buf_w, buf_h;
|
int buf_w, buf_h;
|
||||||
pixman_transform_t scaling;
|
pixman_transform_t scaling;
|
||||||
|
|
||||||
assert(scale >= 1);
|
test_assert_int_ge(scale, 1);
|
||||||
|
|
||||||
fname = image_filename(basename);
|
fname = image_filename(basename);
|
||||||
img = load_image_from_png(fname);
|
img = load_image_from_png(fname);
|
||||||
free(fname);
|
free(fname);
|
||||||
assert(img);
|
test_assert_ptr_not_null(img);
|
||||||
|
|
||||||
buf_w = scale * pixman_image_get_width(img);
|
buf_w = scale * pixman_image_get_width(img);
|
||||||
buf_h = scale * pixman_image_get_height(img);
|
buf_h = scale * pixman_image_get_height(img);
|
||||||
|
|
@ -2134,14 +2149,16 @@ bind_to_singleton_global(struct client *client,
|
||||||
if (strcmp(tmp->interface, iface->name))
|
if (strcmp(tmp->interface, iface->name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
assert(!g && "multiple singleton objects");
|
/* Multiple singleton objects. */
|
||||||
|
test_assert_ptr_null(g);
|
||||||
g = tmp;
|
g = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(g && "singleton not found");
|
/* Singleton not found. */
|
||||||
|
test_assert_ptr_not_null(g);
|
||||||
|
|
||||||
proxy = wl_registry_bind(client->wl_registry, g->name, iface, version);
|
proxy = wl_registry_bind(client->wl_registry, g->name, iface, version);
|
||||||
assert(proxy);
|
test_assert_ptr_not_null(proxy);
|
||||||
|
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
|
@ -2162,7 +2179,7 @@ client_create_viewport(struct client *client)
|
||||||
&wp_viewporter_interface, 1);
|
&wp_viewporter_interface, 1);
|
||||||
viewport = wp_viewporter_get_viewport(viewporter,
|
viewport = wp_viewporter_get_viewport(viewporter,
|
||||||
client->surface->wl_surface);
|
client->surface->wl_surface);
|
||||||
assert(viewport);
|
test_assert_ptr_not_null(viewport);
|
||||||
wp_viewporter_destroy(viewporter);
|
wp_viewporter_destroy(viewporter);
|
||||||
|
|
||||||
return viewport;
|
return viewport;
|
||||||
|
|
@ -2252,14 +2269,14 @@ client_wait_breakpoint(struct client *client,
|
||||||
{
|
{
|
||||||
struct wet_test_active_breakpoint *active_bp;
|
struct wet_test_active_breakpoint *active_bp;
|
||||||
|
|
||||||
assert(suite_data);
|
test_assert_ptr_not_null(suite_data);
|
||||||
assert(!suite_data->breakpoints.in_client_break);
|
test_assert_false(suite_data->breakpoints.in_client_break);
|
||||||
|
|
||||||
wl_display_flush(client->wl_display);
|
wl_display_flush(client->wl_display);
|
||||||
wet_test_wait_sem(&suite_data->breakpoints.client_break);
|
wet_test_wait_sem(&suite_data->breakpoints.client_break);
|
||||||
|
|
||||||
active_bp = suite_data->breakpoints.active_bp;
|
active_bp = suite_data->breakpoints.active_bp;
|
||||||
assert(active_bp);
|
test_assert_ptr_not_null(active_bp);
|
||||||
suite_data->breakpoints.in_client_break = true;
|
suite_data->breakpoints.in_client_break = true;
|
||||||
return active_bp;
|
return active_bp;
|
||||||
}
|
}
|
||||||
|
|
@ -2270,14 +2287,14 @@ get_resource_data_from_proxy(struct wet_testsuite_data *suite_data,
|
||||||
{
|
{
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
|
|
||||||
assert(suite_data->breakpoints.in_client_break);
|
test_assert_true(suite_data->breakpoints.in_client_break);
|
||||||
|
|
||||||
if (!proxy)
|
if (!proxy)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
resource = wl_client_get_object(suite_data->wl_client,
|
resource = wl_client_get_object(suite_data->wl_client,
|
||||||
wl_proxy_get_id(proxy));
|
wl_proxy_get_id(proxy));
|
||||||
assert(resource);
|
test_assert_ptr_not_null(resource);
|
||||||
return wl_resource_get_user_data(resource);
|
return wl_resource_get_user_data(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2302,7 +2319,7 @@ client_insert_breakpoint(struct client *client,
|
||||||
{
|
{
|
||||||
struct wet_test_pending_breakpoint *bp;
|
struct wet_test_pending_breakpoint *bp;
|
||||||
|
|
||||||
assert(suite_data->breakpoints.in_client_break);
|
test_assert_true(suite_data->breakpoints.in_client_break);
|
||||||
|
|
||||||
bp = xzalloc(sizeof(*bp));
|
bp = xzalloc(sizeof(*bp));
|
||||||
bp->breakpoint = breakpoint;
|
bp->breakpoint = breakpoint;
|
||||||
|
|
@ -2331,7 +2348,7 @@ client_remove_breakpoint(struct client *client,
|
||||||
struct wet_test_pending_breakpoint *bp, *tmp;
|
struct wet_test_pending_breakpoint *bp, *tmp;
|
||||||
void *resource = get_resource_data_from_proxy(suite_data, proxy);
|
void *resource = get_resource_data_from_proxy(suite_data, proxy);
|
||||||
|
|
||||||
assert(suite_data->breakpoints.in_client_break);
|
test_assert_true(suite_data->breakpoints.in_client_break);
|
||||||
|
|
||||||
wl_list_for_each_safe(bp, tmp, &suite_data->breakpoints.list,
|
wl_list_for_each_safe(bp, tmp, &suite_data->breakpoints.list,
|
||||||
link) {
|
link) {
|
||||||
|
|
@ -2339,13 +2356,13 @@ client_remove_breakpoint(struct client *client,
|
||||||
continue;
|
continue;
|
||||||
if (bp->resource != resource)
|
if (bp->resource != resource)
|
||||||
continue;
|
continue;
|
||||||
assert(bp != suite_data->breakpoints.active_bp->template_);
|
test_assert_ptr_ne(bp, suite_data->breakpoints.active_bp->template_);
|
||||||
wl_list_remove(&bp->link);
|
wl_list_remove(&bp->link);
|
||||||
free(bp);
|
free(bp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!"couldn't find breakpoint to remove");
|
test_assert_not_reached("couldn't find breakpoint to remove");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2360,7 +2377,7 @@ client_release_breakpoint(struct client *client,
|
||||||
struct wet_testsuite_data *suite_data,
|
struct wet_testsuite_data *suite_data,
|
||||||
struct wet_test_active_breakpoint *active_bp)
|
struct wet_test_active_breakpoint *active_bp)
|
||||||
{
|
{
|
||||||
assert(suite_data->breakpoints.active_bp == active_bp);
|
test_assert_ptr_eq(suite_data->breakpoints.active_bp, active_bp);
|
||||||
|
|
||||||
if (active_bp->rearm_on_release) {
|
if (active_bp->rearm_on_release) {
|
||||||
wl_list_insert(&suite_data->breakpoints.list,
|
wl_list_insert(&suite_data->breakpoints.list,
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
@ -241,7 +240,7 @@ void
|
||||||
move_client_offscreenable(struct client *client, int x, int y);
|
move_client_offscreenable(struct client *client, int x, int y);
|
||||||
|
|
||||||
#define client_roundtrip(c) do { \
|
#define client_roundtrip(c) do { \
|
||||||
assert(wl_display_roundtrip((c)->wl_display) >= 0); \
|
test_assert_int_ge(wl_display_roundtrip((c)->wl_display), 0); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
struct wl_callback *
|
struct wl_callback *
|
||||||
|
|
@ -250,7 +249,7 @@ frame_callback_set(struct wl_surface *surface, int *done);
|
||||||
int
|
int
|
||||||
frame_callback_wait_nofail(struct client *client, int *done);
|
frame_callback_wait_nofail(struct client *client, int *done);
|
||||||
|
|
||||||
#define frame_callback_wait(c, d) assert(frame_callback_wait_nofail((c), (d)))
|
#define frame_callback_wait(c, d) test_assert_true(frame_callback_wait_nofail((c), (d)))
|
||||||
|
|
||||||
void
|
void
|
||||||
expect_protocol_error(struct client *client,
|
expect_protocol_error(struct client *client,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <libudev.h>
|
#include <libudev.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
|
|
@ -40,6 +39,7 @@
|
||||||
#include "shared/helpers.h"
|
#include "shared/helpers.h"
|
||||||
#include "shared/string-helpers.h"
|
#include "shared/string-helpers.h"
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "weston.h"
|
#include "weston.h"
|
||||||
#include "test-config.h"
|
#include "test-config.h"
|
||||||
|
|
||||||
|
|
@ -62,12 +62,12 @@ prog_args_init(struct prog_args *p)
|
||||||
static void
|
static void
|
||||||
prog_args_take(struct prog_args *p, char *arg)
|
prog_args_take(struct prog_args *p, char *arg)
|
||||||
{
|
{
|
||||||
assert(arg);
|
test_assert_ptr_not_null(arg);
|
||||||
|
|
||||||
if (p->argc == p->alloc) {
|
if (p->argc == p->alloc) {
|
||||||
p->alloc += 10;
|
p->alloc += 10;
|
||||||
p->argv = realloc(p->argv, sizeof(char *) * p->alloc);
|
p->argv = realloc(p->argv, sizeof(char *) * p->alloc);
|
||||||
assert(p->argv);
|
test_assert_ptr_not_null(p->argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
p->argv[p->argc++] = arg;
|
p->argv[p->argc++] = arg;
|
||||||
|
|
@ -80,10 +80,10 @@ prog_args_take(struct prog_args *p, char *arg)
|
||||||
static void
|
static void
|
||||||
prog_args_save(struct prog_args *p)
|
prog_args_save(struct prog_args *p)
|
||||||
{
|
{
|
||||||
assert(p->saved == NULL);
|
test_assert_ptr_null(p->saved);
|
||||||
|
|
||||||
p->saved = calloc(p->argc, sizeof(char *));
|
p->saved = calloc(p->argc, sizeof(char *));
|
||||||
assert(p->saved);
|
test_assert_true(p->saved);
|
||||||
|
|
||||||
memcpy(p->saved, p->argv, sizeof(char *) * p->argc);
|
memcpy(p->saved, p->argv, sizeof(char *) * p->argc);
|
||||||
}
|
}
|
||||||
|
|
@ -216,7 +216,7 @@ backend_to_str(enum weston_compositor_backend b)
|
||||||
[WESTON_BACKEND_WAYLAND] = "wayland",
|
[WESTON_BACKEND_WAYLAND] = "wayland",
|
||||||
[WESTON_BACKEND_X11] = "x11",
|
[WESTON_BACKEND_X11] = "x11",
|
||||||
};
|
};
|
||||||
assert(b >= 0 && b < ARRAY_LENGTH(names));
|
test_assert_true(b >= 0 && b < ARRAY_LENGTH(names));
|
||||||
return names[b];
|
return names[b];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ renderer_to_str(enum weston_renderer_type t)
|
||||||
[WESTON_RENDERER_PIXMAN] = "pixman",
|
[WESTON_RENDERER_PIXMAN] = "pixman",
|
||||||
[WESTON_RENDERER_GL] = "gl",
|
[WESTON_RENDERER_GL] = "gl",
|
||||||
};
|
};
|
||||||
assert(t >= 0 && t <= ARRAY_LENGTH(names));
|
test_assert_true(t >= 0 && t <= ARRAY_LENGTH(names));
|
||||||
return names[t];
|
return names[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,7 +242,7 @@ shell_to_str(enum shell_type t)
|
||||||
[SHELL_IVI] = "ivi",
|
[SHELL_IVI] = "ivi",
|
||||||
[SHELL_KIOSK] = "kiosk",
|
[SHELL_KIOSK] = "kiosk",
|
||||||
};
|
};
|
||||||
assert(t >= 0 && t < ARRAY_LENGTH(names));
|
test_assert_true(t >= 0 && t < ARRAY_LENGTH(names));
|
||||||
return names[t];
|
return names[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ transform_to_str(enum wl_output_transform t)
|
||||||
[WL_OUTPUT_TRANSFORM_FLIPPED_270] = "flipped-rotate-270",
|
[WL_OUTPUT_TRANSFORM_FLIPPED_270] = "flipped-rotate-270",
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(t < ARRAY_LENGTH(names) && names[t]);
|
test_assert_true(t < ARRAY_LENGTH(names) && names[t]);
|
||||||
return names[t];
|
return names[t];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -436,11 +436,11 @@ write_cfg(va_list entry_list, FILE *weston_ini)
|
||||||
{
|
{
|
||||||
char *entry = va_arg(entry_list, char *);
|
char *entry = va_arg(entry_list, char *);
|
||||||
int ret;
|
int ret;
|
||||||
assert(entry);
|
test_assert_ptr_not_null(entry);
|
||||||
|
|
||||||
while (entry) {
|
while (entry) {
|
||||||
ret = fprintf(weston_ini, "%s\n", entry);
|
ret = fprintf(weston_ini, "%s\n", entry);
|
||||||
assert(ret >= 0);
|
test_assert_int_ge(ret, 0);
|
||||||
free(entry);
|
free(entry);
|
||||||
entry = va_arg(entry_list, char *);
|
entry = va_arg(entry_list, char *);
|
||||||
}
|
}
|
||||||
|
|
@ -452,10 +452,10 @@ open_ini_file(struct compositor_setup *setup)
|
||||||
char *wd, *tmp_path = NULL;
|
char *wd, *tmp_path = NULL;
|
||||||
FILE *weston_ini = NULL;
|
FILE *weston_ini = NULL;
|
||||||
|
|
||||||
assert(!setup->config_file);
|
test_assert_ptr_null(setup->config_file);
|
||||||
|
|
||||||
wd = realpath(".", NULL);
|
wd = realpath(".", NULL);
|
||||||
assert(wd);
|
test_assert_ptr_not_null(wd);
|
||||||
|
|
||||||
str_printf(&tmp_path, "%s/%s.ini", wd, setup->testset_name);
|
str_printf(&tmp_path, "%s/%s.ini", wd, setup->testset_name);
|
||||||
if (!tmp_path) {
|
if (!tmp_path) {
|
||||||
|
|
@ -464,7 +464,7 @@ open_ini_file(struct compositor_setup *setup)
|
||||||
}
|
}
|
||||||
|
|
||||||
weston_ini = fopen(tmp_path, "w");
|
weston_ini = fopen(tmp_path, "w");
|
||||||
assert(weston_ini);
|
test_assert_ptr_not_null(weston_ini);
|
||||||
setup->config_file = tmp_path;
|
setup->config_file = tmp_path;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
@ -480,14 +480,14 @@ weston_ini_setup_(struct compositor_setup *setup, ...)
|
||||||
va_list entry_list;
|
va_list entry_list;
|
||||||
|
|
||||||
weston_ini = open_ini_file(setup);
|
weston_ini = open_ini_file(setup);
|
||||||
assert(weston_ini);
|
test_assert_ptr_not_null(weston_ini);
|
||||||
|
|
||||||
va_start(entry_list, setup);
|
va_start(entry_list, setup);
|
||||||
write_cfg(entry_list, weston_ini);
|
write_cfg(entry_list, weston_ini);
|
||||||
va_end(entry_list);
|
va_end(entry_list);
|
||||||
|
|
||||||
ret = fclose(weston_ini);
|
ret = fclose(weston_ini);
|
||||||
assert(ret != EOF);
|
test_assert_int_ne(ret, EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|
@ -499,7 +499,7 @@ cfgln(const char *fmt, ...)
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
ret = vasprintf(&str, fmt, ap);
|
ret = vasprintf(&str, fmt, ap);
|
||||||
assert(ret >= 0);
|
test_assert_int_ge(ret, 0);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
|
@ -38,6 +37,7 @@
|
||||||
|
|
||||||
#include "test-config.h"
|
#include "test-config.h"
|
||||||
#include "weston-test-runner.h"
|
#include "weston-test-runner.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "weston-testsuite-data.h"
|
#include "weston-testsuite-data.h"
|
||||||
#include "shared/string-helpers.h"
|
#include "shared/string-helpers.h"
|
||||||
|
|
||||||
|
|
@ -274,7 +274,7 @@ result_to_str(enum test_result_code ret)
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
assert(ret >= 0 && ret < ARRAY_LENGTH(names));
|
test_assert_true(ret >= 0 && ret < ARRAY_LENGTH(names));
|
||||||
return names[ret];
|
return names[ret];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -458,7 +458,7 @@ weston_test_harness_create(int argc, char **argv)
|
||||||
struct weston_test_harness *harness;
|
struct weston_test_harness *harness;
|
||||||
|
|
||||||
harness = zalloc(sizeof(*harness));
|
harness = zalloc(sizeof(*harness));
|
||||||
assert(harness);
|
test_assert_ptr_not_null(harness);
|
||||||
|
|
||||||
harness->fixt_ind = -1;
|
harness->fixt_ind = -1;
|
||||||
harness->case_ind = -1;
|
harness->case_ind = -1;
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,7 @@ test_seat_release(struct weston_test *test)
|
||||||
|
|
||||||
assert(test->is_seat_initialized &&
|
assert(test->is_seat_initialized &&
|
||||||
"Trying to release already released test seat");
|
"Trying to release already released test seat");
|
||||||
|
|
||||||
test->is_seat_initialized = false;
|
test->is_seat_initialized = false;
|
||||||
weston_seat_release(&test->seat);
|
weston_seat_release(&test->seat);
|
||||||
memset(&test->seat, 0, sizeof test->seat);
|
memset(&test->seat, 0, sizeof test->seat);
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,11 @@
|
||||||
#ifndef WESTON_TESTSUITE_DATA_H
|
#ifndef WESTON_TESTSUITE_DATA_H
|
||||||
#define WESTON_TESTSUITE_DATA_H
|
#define WESTON_TESTSUITE_DATA_H
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
|
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
/** Standard return codes
|
/** Standard return codes
|
||||||
*
|
*
|
||||||
* Both Autotools and Meson use these codes as test program exit codes
|
* Both Autotools and Meson use these codes as test program exit codes
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ handle_unmap_notify(xcb_generic_event_t *e, struct window_x11 *window)
|
||||||
if (ce->window != window->win_id && ce->window != window->frame_id)
|
if (ce->window != window->win_id && ce->window != window->frame_id)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
assert(window_state_has_flag(window, MAPPED));
|
test_assert_true(window_state_has_flag(window, MAPPED));
|
||||||
window_state_set_flag(window, UNMAPPED);
|
window_state_set_flag(window, UNMAPPED);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -251,7 +251,7 @@ handle_destroy_notify(xcb_generic_event_t *e, struct window_x11 *window)
|
||||||
if (window->win_id != dn->window)
|
if (window->win_id != dn->window)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
assert(window_state_has_flag(window, CREATED));
|
test_assert_true(window_state_has_flag(window, CREATED));
|
||||||
window_state_set_flag(window, DESTROYED);
|
window_state_set_flag(window, DESTROYED);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -383,8 +383,8 @@ window_x11_unmap(struct window_x11 *window)
|
||||||
static void
|
static void
|
||||||
window_x11_set_cursor(struct window_x11 *window, const char *cursor_name)
|
window_x11_set_cursor(struct window_x11 *window, const char *cursor_name)
|
||||||
{
|
{
|
||||||
assert(window);
|
test_assert_ptr_not_null(window);
|
||||||
assert(window->ctx == NULL);
|
test_assert_ptr_null(window->ctx);
|
||||||
|
|
||||||
if (xcb_cursor_context_new(window->conn->connection,
|
if (xcb_cursor_context_new(window->conn->connection,
|
||||||
window->screen, &window->ctx) < 0) {
|
window->screen, &window->ctx) < 0) {
|
||||||
|
|
@ -447,7 +447,7 @@ handle_events_x11(struct window_x11 *window)
|
||||||
xcb_generic_event_t *ev;
|
xcb_generic_event_t *ev;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
assert(window->handle_in_progress == false);
|
test_assert_false(window->handle_in_progress);
|
||||||
window->handle_in_progress = true;
|
window->handle_in_progress = true;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
@ -601,7 +601,7 @@ create_x11_window(int width, int height, int pos_x, int pos_y,
|
||||||
xcb_generic_error_t *error_create;
|
xcb_generic_error_t *error_create;
|
||||||
const struct xcb_setup_t *xcb_setup;
|
const struct xcb_setup_t *xcb_setup;
|
||||||
|
|
||||||
assert(conn);
|
test_assert_ptr_not_null(conn);
|
||||||
window = xzalloc(sizeof(*window));
|
window = xzalloc(sizeof(*window));
|
||||||
|
|
||||||
window->conn = conn;
|
window->conn = conn;
|
||||||
|
|
@ -624,7 +624,7 @@ create_x11_window(int width, int height, int pos_x, int pos_y,
|
||||||
cookie = xcb_alloc_color(window->conn->connection, colormap,
|
cookie = xcb_alloc_color(window->conn->connection, colormap,
|
||||||
bg_color.red, bg_color.blue, bg_color.green);
|
bg_color.red, bg_color.blue, bg_color.green);
|
||||||
reply = xcb_alloc_color_reply(window->conn->connection, cookie, NULL);
|
reply = xcb_alloc_color_reply(window->conn->connection, cookie, NULL);
|
||||||
assert(reply);
|
test_assert_ptr_not_null(reply);
|
||||||
|
|
||||||
colorpixel = reply->pixel;
|
colorpixel = reply->pixel;
|
||||||
free(reply);
|
free(reply);
|
||||||
|
|
@ -666,7 +666,7 @@ create_x11_window(int width, int height, int pos_x, int pos_y,
|
||||||
window->screen->root_visual,
|
window->screen->root_visual,
|
||||||
mask, values);
|
mask, values);
|
||||||
error_create = xcb_request_check(window->conn->connection, cookie_create);
|
error_create = xcb_request_check(window->conn->connection, cookie_create);
|
||||||
assert(error_create == NULL);
|
test_assert_ptr_null(error_create);
|
||||||
|
|
||||||
window_state_set_flag(window, CREATED);
|
window_state_set_flag(window, CREATED);
|
||||||
window_x11_set_cursor(window, "left_ptr");
|
window_x11_set_cursor(window, "left_ptr");
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
@ -39,6 +38,8 @@
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_cursor.h>
|
#include <xcb/xcb_cursor.h>
|
||||||
|
|
||||||
|
#include "weston-test-assert.h"
|
||||||
|
|
||||||
enum w_state {
|
enum w_state {
|
||||||
CREATED = 1 << 0,
|
CREATED = 1 << 0,
|
||||||
MAPPED = 1 << 1,
|
MAPPED = 1 << 1,
|
||||||
|
|
@ -188,8 +189,8 @@ handle_events_and_check_flags(struct window_x11 *win, enum w_state flag)
|
||||||
if ((wstate->pending_state & flag) == flag)
|
if ((wstate->pending_state & flag) == flag)
|
||||||
found_pending_flag = true;
|
found_pending_flag = true;
|
||||||
}
|
}
|
||||||
assert(found_pending_flag);
|
test_assert_true(found_pending_flag);
|
||||||
|
|
||||||
handle_events_x11(win);
|
handle_events_x11(win);
|
||||||
assert(window_state_has_flag(win, flag));
|
test_assert_true(window_state_has_flag(win, flag));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
@ -46,6 +45,7 @@
|
||||||
#include "weston-test-fixture-compositor.h"
|
#include "weston-test-fixture-compositor.h"
|
||||||
#include "shared/string-helpers.h"
|
#include "shared/string-helpers.h"
|
||||||
#include "weston-test-client-helper.h"
|
#include "weston-test-client-helper.h"
|
||||||
|
#include "weston-test-assert.h"
|
||||||
#include "xcb-client-helper.h"
|
#include "xcb-client-helper.h"
|
||||||
|
|
||||||
static enum test_result_code
|
static enum test_result_code
|
||||||
|
|
@ -73,12 +73,12 @@ get_x11_window_name(struct window_x11 *window, xcb_drawable_t win)
|
||||||
struct atom_x11 *atoms = window_get_atoms(window);
|
struct atom_x11 *atoms = window_get_atoms(window);
|
||||||
|
|
||||||
reply = window_x11_dump_prop(window, win, atoms->net_wm_name);
|
reply = window_x11_dump_prop(window, win, atoms->net_wm_name);
|
||||||
assert(reply);
|
test_assert_ptr_not_null(reply);
|
||||||
|
|
||||||
assert(reply->type == atoms->string ||
|
test_assert_true(reply->type == atoms->string ||
|
||||||
reply->type == atoms->utf8_string);
|
reply->type == atoms->utf8_string);
|
||||||
reply_len = xcb_get_property_value_length(reply);
|
reply_len = xcb_get_property_value_length(reply);
|
||||||
assert(reply_len > 0);
|
test_assert_int_gt(reply_len, 0);
|
||||||
|
|
||||||
str_printf(&name, "%.*s", reply_len,
|
str_printf(&name, "%.*s", reply_len,
|
||||||
(char *) xcb_get_property_value(reply));
|
(char *) xcb_get_property_value(reply));
|
||||||
|
|
@ -100,9 +100,9 @@ get_wm_name(struct window_x11 *window)
|
||||||
atoms->net_supporting_wm_check,
|
atoms->net_supporting_wm_check,
|
||||||
XCB_ATOM_WINDOW, 0, 1024);
|
XCB_ATOM_WINDOW, 0, 1024);
|
||||||
reply = xcb_get_property_reply(conn, prop_cookie, &error);
|
reply = xcb_get_property_reply(conn, prop_cookie, &error);
|
||||||
assert(reply);
|
test_assert_ptr_not_null(reply);
|
||||||
assert(reply->type == XCB_ATOM_WINDOW);
|
test_assert_enum(reply->type, XCB_ATOM_WINDOW);
|
||||||
assert(reply->format == 32);
|
test_assert_u8_eq(reply->format, 32);
|
||||||
|
|
||||||
xcb_window_t wm_id = *(xcb_window_t *) xcb_get_property_value(reply);
|
xcb_window_t wm_id = *(xcb_window_t *) xcb_get_property_value(reply);
|
||||||
wm_name = get_x11_window_name(window, wm_id);
|
wm_name = get_x11_window_name(window, wm_id);
|
||||||
|
|
@ -124,12 +124,12 @@ TEST(xwayland_client_test)
|
||||||
|
|
||||||
color_rgb888(&bg_color, 255, 0, 0);
|
color_rgb888(&bg_color, 255, 0, 0);
|
||||||
|
|
||||||
assert(getenv("DISPLAY"));
|
test_assert_ptr_not_null(getenv("DISPLAY"));
|
||||||
|
|
||||||
conn = create_x11_connection();
|
conn = create_x11_connection();
|
||||||
assert(conn);
|
test_assert_ptr_not_null(conn);
|
||||||
window = create_x11_window(100, 100, 100, 100, conn, bg_color, NULL);
|
window = create_x11_window(100, 100, 100, 100, conn, bg_color, NULL);
|
||||||
assert(window);
|
test_assert_ptr_not_null(window);
|
||||||
|
|
||||||
window_x11_set_win_name(window, "Xwayland Test Window");
|
window_x11_set_win_name(window, "Xwayland Test Window");
|
||||||
handle_events_and_check_flags(window, PROPERTY_NAME);
|
handle_events_and_check_flags(window, PROPERTY_NAME);
|
||||||
|
|
@ -149,27 +149,27 @@ TEST(xwayland_client_test)
|
||||||
* _NET_SUPPORTING_WM_CHECK
|
* _NET_SUPPORTING_WM_CHECK
|
||||||
* */
|
* */
|
||||||
atoms = window_get_atoms(window);
|
atoms = window_get_atoms(window);
|
||||||
assert(atoms->net_supporting_wm_check != XCB_ATOM_NONE);
|
test_assert_false(atoms->net_supporting_wm_check == XCB_ATOM_NONE);
|
||||||
assert(atoms->wl_surface_id != XCB_ATOM_NONE);
|
test_assert_false(atoms->wl_surface_id == XCB_ATOM_NONE);
|
||||||
assert(atoms->net_wm_name != XCB_ATOM_NONE);
|
test_assert_false(atoms->net_wm_name == XCB_ATOM_NONE);
|
||||||
assert(atoms->utf8_string != XCB_ATOM_NONE);
|
test_assert_false(atoms->utf8_string == XCB_ATOM_NONE);
|
||||||
|
|
||||||
reply = window_x11_dump_prop(window, window->root_win_id,
|
reply = window_x11_dump_prop(window, window->root_win_id,
|
||||||
atoms->net_supporting_wm_check);
|
atoms->net_supporting_wm_check);
|
||||||
assert(reply);
|
test_assert_ptr_not_null(reply);
|
||||||
assert(reply->type == XCB_ATOM_WINDOW);
|
test_assert_u8_eq(reply->type, XCB_ATOM_WINDOW);
|
||||||
free(reply);
|
free(reply);
|
||||||
|
|
||||||
window_x11_map(window);
|
window_x11_map(window);
|
||||||
handle_events_and_check_flags(window, MAPPED);
|
handle_events_and_check_flags(window, MAPPED);
|
||||||
|
|
||||||
win_name = get_x11_window_name(window, window->win_id);
|
win_name = get_x11_window_name(window, window->win_id);
|
||||||
assert(strcmp(win_name, "Xwayland Test Window") == 0);
|
test_assert_str_eq(win_name, "Xwayland Test Window");
|
||||||
free(win_name);
|
free(win_name);
|
||||||
|
|
||||||
wm_name = get_wm_name(window);
|
wm_name = get_wm_name(window);
|
||||||
assert(wm_name);
|
test_assert_ptr_not_null(wm_name);
|
||||||
assert(strcmp(wm_name, "Weston WM") == 0);
|
test_assert_str_eq(wm_name, "Weston WM");
|
||||||
free(wm_name);
|
free(wm_name);
|
||||||
|
|
||||||
window_x11_unmap(window);
|
window_x11_unmap(window);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue