You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1022 lines
28 KiB
1022 lines
28 KiB
10 years ago
|
/*
|
||
|
* Copyright © 2013 DENSO CORPORATION
|
||
|
* Copyright © 2015 Collabora, Ltd.
|
||
|
*
|
||
10 years ago
|
* Permission is hereby granted, free of charge, to any person obtaining
|
||
|
* a copy of this software and associated documentation files (the
|
||
|
* "Software"), to deal in the Software without restriction, including
|
||
|
* without limitation the rights to use, copy, modify, merge, publish,
|
||
|
* distribute, sublicense, and/or sell copies of the Software, and to
|
||
|
* permit persons to whom the Software is furnished to do so, subject to
|
||
|
* the following conditions:
|
||
10 years ago
|
*
|
||
10 years ago
|
* The above copyright notice and this permission notice (including the
|
||
|
* next paragraph) shall be included in all copies or substantial
|
||
|
* portions of the Software.
|
||
|
*
|
||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
|
* SOFTWARE.
|
||
10 years ago
|
*/
|
||
|
|
||
|
#include "config.h"
|
||
|
|
||
|
#include <unistd.h>
|
||
|
#include <signal.h>
|
||
|
#include <string.h>
|
||
|
#include <stdbool.h>
|
||
9 years ago
|
#include <stdint.h>
|
||
10 years ago
|
|
||
9 years ago
|
#include "compositor.h"
|
||
7 years ago
|
#include "compositor/weston.h"
|
||
10 years ago
|
#include "ivi-shell/ivi-layout-export.h"
|
||
10 years ago
|
#include "ivi-shell/ivi-layout-private.h"
|
||
10 years ago
|
#include "ivi-test.h"
|
||
9 years ago
|
#include "shared/helpers.h"
|
||
10 years ago
|
|
||
|
struct test_context {
|
||
|
struct weston_compositor *compositor;
|
||
9 years ago
|
const struct ivi_layout_interface *layout_interface;
|
||
10 years ago
|
uint32_t user_flags;
|
||
9 years ago
|
|
||
|
struct wl_listener layer_property_changed;
|
||
9 years ago
|
struct wl_listener layer_created;
|
||
9 years ago
|
struct wl_listener layer_removed;
|
||
10 years ago
|
};
|
||
|
|
||
|
static void
|
||
|
iassert_fail(const char *cond, const char *file, int line,
|
||
|
const char *func, struct test_context *ctx)
|
||
|
{
|
||
|
weston_log("Assert failure in %s:%d, %s: '%s'\n",
|
||
|
file, line, func, cond);
|
||
|
weston_compositor_exit_with_code(ctx->compositor, EXIT_FAILURE);
|
||
|
}
|
||
|
|
||
|
#define iassert(cond) ({ \
|
||
|
bool b_ = (cond); \
|
||
|
if (!b_) \
|
||
|
iassert_fail(#cond, __FILE__, __LINE__, __func__, ctx); \
|
||
|
b_; \
|
||
|
})
|
||
|
|
||
|
/************************ tests begin ******************************/
|
||
|
|
||
|
/*
|
||
|
* These are all internal ivi_layout API tests that do not require
|
||
|
* any client objects.
|
||
|
*/
|
||
|
static void
|
||
|
test_surface_bad_visibility(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->surface_set_visibility(NULL, true) == IVI_FAILED);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
static void
|
||
|
test_surface_bad_destination_rectangle(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->surface_set_destination_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_surface_bad_source_rectangle(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->surface_set_source_rectangle(NULL, 20, 30, 200, 300) == IVI_FAILED);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_surface_bad_properties(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->get_properties_of_surface(NULL) == NULL);
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
static void
|
||
|
test_layer_create(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
uint32_t id1;
|
||
|
uint32_t id2;
|
||
|
struct ivi_layout_layer *ivilayer;
|
||
|
struct ivi_layout_layer *new_ivilayer;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
iassert(IVI_TEST_LAYER_ID(0) == lyt->get_id_of_layer(ivilayer));
|
||
10 years ago
|
|
||
9 years ago
|
new_ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
|
||
10 years ago
|
iassert(ivilayer == new_ivilayer);
|
||
|
|
||
9 years ago
|
id1 = lyt->get_id_of_layer(ivilayer);
|
||
|
id2 = lyt->get_id_of_layer(new_ivilayer);
|
||
10 years ago
|
iassert(id1 == id2);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
|
iassert(lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0)) == NULL);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_visibility(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
const struct ivi_layout_layer_properties *prop;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
|
|
||
|
iassert(prop->visibility == false);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(prop->visibility == false);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
|
iassert(prop->visibility == true);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_opacity(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
const struct ivi_layout_layer_properties *prop;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
|
iassert(prop->opacity == wl_fixed_from_double(1.0));
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_opacity(
|
||
10 years ago
|
ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
|
||
|
|
||
9 years ago
|
iassert(prop->opacity == wl_fixed_from_double(1.0));
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
|
iassert(prop->opacity == wl_fixed_from_double(0.5));
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_dimension(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
const struct ivi_layout_layer_properties *prop;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
|
iassert(prop->dest_width == 200);
|
||
|
iassert(prop->dest_height == 300);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_destination_rectangle(ivilayer, prop->dest_x, prop->dest_y,
|
||
|
400, 600) == IVI_SUCCEEDED);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(prop->dest_width == 200);
|
||
|
iassert(prop->dest_height == 300);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
|
iassert(prop->dest_width == 400);
|
||
|
iassert(prop->dest_height == 600);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_position(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
const struct ivi_layout_layer_properties *prop;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
|
iassert(prop->dest_x == 0);
|
||
|
iassert(prop->dest_y == 0);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_destination_rectangle(ivilayer, 20, 30,
|
||
|
prop->dest_width, prop->dest_height) == IVI_SUCCEEDED);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(prop->dest_x == 0);
|
||
|
iassert(prop->dest_y == 0);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
iassert(prop->dest_x == 20);
|
||
|
iassert(prop->dest_y == 30);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_destination_rectangle(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
const struct ivi_layout_layer_properties *prop;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
iassert(prop->dest_width == 200);
|
||
|
iassert(prop->dest_height == 300);
|
||
|
iassert(prop->dest_x == 0);
|
||
|
iassert(prop->dest_y == 0);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_destination_rectangle(
|
||
10 years ago
|
ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
|
||
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
iassert(prop->dest_width == 200);
|
||
|
iassert(prop->dest_height == 300);
|
||
|
iassert(prop->dest_x == 0);
|
||
|
iassert(prop->dest_y == 0);
|
||
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
|
iassert(prop->dest_width == 400);
|
||
|
iassert(prop->dest_height == 600);
|
||
|
iassert(prop->dest_x == 20);
|
||
|
iassert(prop->dest_y == 30);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_source_rectangle(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
const struct ivi_layout_layer_properties *prop;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
iassert(prop->source_width == 200);
|
||
|
iassert(prop->source_height == 300);
|
||
|
iassert(prop->source_x == 0);
|
||
|
iassert(prop->source_y == 0);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_source_rectangle(
|
||
10 years ago
|
ivilayer, 20, 30, 400, 600) == IVI_SUCCEEDED);
|
||
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
iassert(prop->source_width == 200);
|
||
|
iassert(prop->source_height == 300);
|
||
|
iassert(prop->source_x == 0);
|
||
|
iassert(prop->source_y == 0);
|
||
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
iassert(prop->source_width == 400);
|
||
|
iassert(prop->source_height == 600);
|
||
|
iassert(prop->source_x == 20);
|
||
|
iassert(prop->source_y == 30);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
static void
|
||
|
test_layer_bad_remove(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
|
lyt->layer_destroy(NULL);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_bad_visibility(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_visibility(NULL, true) == IVI_FAILED);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_bad_opacity(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
9 years ago
|
const struct ivi_layout_layer_properties *prop;
|
||
10 years ago
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_opacity(
|
||
10 years ago
|
NULL, wl_fixed_from_double(0.3)) == IVI_FAILED);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_opacity(
|
||
10 years ago
|
ivilayer, wl_fixed_from_double(0.3)) == IVI_SUCCEEDED);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_opacity(
|
||
10 years ago
|
ivilayer, wl_fixed_from_double(-1)) == IVI_FAILED);
|
||
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
prop = lyt->get_properties_of_layer(ivilayer);
|
||
|
iassert(prop->opacity == wl_fixed_from_double(0.3));
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_opacity(
|
||
10 years ago
|
ivilayer, wl_fixed_from_double(1.1)) == IVI_FAILED);
|
||
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
iassert(prop->opacity == wl_fixed_from_double(0.3));
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_opacity(
|
||
10 years ago
|
NULL, wl_fixed_from_double(0.5)) == IVI_FAILED);
|
||
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_bad_destination_rectangle(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_destination_rectangle(
|
||
10 years ago
|
NULL, 20, 30, 200, 300) == IVI_FAILED);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_bad_source_rectangle(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->layer_set_source_rectangle(
|
||
10 years ago
|
NULL, 20, 30, 200, 300) == IVI_FAILED);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_bad_properties(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->get_properties_of_layer(NULL) == NULL);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_commit_changes_after_visibility_set_layer_destroy(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_visibility(ivilayer, true) == IVI_SUCCEEDED);
|
||
|
lyt->layer_destroy(ivilayer);
|
||
|
lyt->commit_changes();
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_commit_changes_after_opacity_set_layer_destroy(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_opacity(
|
||
10 years ago
|
ivilayer, wl_fixed_from_double(0.5)) == IVI_SUCCEEDED);
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
|
lyt->commit_changes();
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_commit_changes_after_source_rectangle_set_layer_destroy(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_source_rectangle(
|
||
10 years ago
|
ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
|
lyt->commit_changes();
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_commit_changes_after_destination_rectangle_set_layer_destroy(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_destination_rectangle(
|
||
10 years ago
|
ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
|
lyt->commit_changes();
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_create_duplicate(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
struct ivi_layout_layer *duplicatelayer;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
|
if (ivilayer != NULL)
|
||
|
iassert(ivilayer->ref_count == 1);
|
||
|
|
||
9 years ago
|
duplicatelayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer == duplicatelayer);
|
||
|
|
||
|
if (ivilayer != NULL)
|
||
|
iassert(ivilayer->ref_count == 2);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
|
||
|
if (ivilayer != NULL)
|
||
|
iassert(ivilayer->ref_count == 1);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_get_layer_after_destory_layer(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
iassert(ivilayer != NULL);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
|
||
9 years ago
|
ivilayer = lyt->get_layer_from_id(IVI_TEST_LAYER_ID(0));
|
||
10 years ago
|
iassert(ivilayer == NULL);
|
||
|
}
|
||
|
|
||
10 years ago
|
static void
|
||
|
test_screen_render_order(struct test_context *ctx)
|
||
|
{
|
||
|
#define LAYER_NUM (3)
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
9 years ago
|
struct weston_output *output;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||
|
struct ivi_layout_layer **array;
|
||
|
int32_t length = 0;
|
||
|
uint32_t i;
|
||
|
|
||
7 years ago
|
if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
|
||
10 years ago
|
return;
|
||
|
|
||
9 years ago
|
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||
10 years ago
|
|
||
|
for (i = 0; i < LAYER_NUM; i++)
|
||
9 years ago
|
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
|
||
10 years ago
|
iassert(length == LAYER_NUM);
|
||
|
for (i = 0; i < LAYER_NUM; i++)
|
||
|
iassert(array[i] == ivilayers[i]);
|
||
|
|
||
|
if (length > 0)
|
||
|
free(array);
|
||
|
|
||
|
array = NULL;
|
||
|
|
||
9 years ago
|
iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
|
||
10 years ago
|
iassert(length == 0 && array == NULL);
|
||
|
|
||
|
for (i = 0; i < LAYER_NUM; i++)
|
||
9 years ago
|
lyt->layer_destroy(ivilayers[i]);
|
||
10 years ago
|
|
||
|
#undef LAYER_NUM
|
||
|
}
|
||
|
|
||
10 years ago
|
static void
|
||
|
test_screen_bad_render_order(struct test_context *ctx)
|
||
|
{
|
||
|
#define LAYER_NUM (3)
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
9 years ago
|
struct weston_output *output;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||
|
struct ivi_layout_layer **array;
|
||
|
int32_t length = 0;
|
||
|
uint32_t i;
|
||
|
|
||
7 years ago
|
if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
|
||
10 years ago
|
return;
|
||
|
|
||
9 years ago
|
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||
10 years ago
|
|
||
|
for (i = 0; i < LAYER_NUM; i++)
|
||
9 years ago
|
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->screen_set_render_order(NULL, ivilayers, LAYER_NUM) == IVI_FAILED);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->get_layers_on_screen(NULL, &length, &array) == IVI_FAILED);
|
||
9 years ago
|
iassert(lyt->get_layers_on_screen(output, NULL, &array) == IVI_FAILED);
|
||
|
iassert(lyt->get_layers_on_screen(output, &length, NULL) == IVI_FAILED);
|
||
10 years ago
|
|
||
|
for (i = 0; i < LAYER_NUM; i++)
|
||
9 years ago
|
lyt->layer_destroy(ivilayers[i]);
|
||
10 years ago
|
|
||
|
#undef LAYER_NUM
|
||
|
}
|
||
|
|
||
8 years ago
|
static void
|
||
|
test_screen_add_layers(struct test_context *ctx)
|
||
|
{
|
||
|
#define LAYER_NUM (3)
|
||
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
|
struct weston_output *output;
|
||
|
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||
|
struct ivi_layout_layer **array;
|
||
|
int32_t length = 0;
|
||
|
uint32_t i;
|
||
|
|
||
7 years ago
|
if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
|
||
8 years ago
|
return;
|
||
|
|
||
|
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||
|
|
||
|
for (i = 0; i < LAYER_NUM; i++) {
|
||
|
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
|
||
|
iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED);
|
||
|
}
|
||
|
|
||
|
lyt->commit_changes();
|
||
|
|
||
|
iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
|
||
|
iassert(length == LAYER_NUM);
|
||
|
for (i = 0; i < (uint32_t)length; i++)
|
||
|
iassert(array[i] == ivilayers[i]);
|
||
|
|
||
|
if (length > 0)
|
||
|
free(array);
|
||
|
|
||
|
array = NULL;
|
||
|
|
||
|
iassert(lyt->screen_set_render_order(output, NULL, 0) == IVI_SUCCEEDED);
|
||
|
for (i = LAYER_NUM; i-- > 0;)
|
||
|
iassert(lyt->screen_add_layer(output, ivilayers[i]) == IVI_SUCCEEDED);
|
||
|
|
||
|
lyt->commit_changes();
|
||
|
|
||
|
iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
|
||
|
iassert(length == LAYER_NUM);
|
||
|
for (i = 0; i < (uint32_t)length; i++)
|
||
|
iassert(array[i] == ivilayers[LAYER_NUM - (i + 1)]);
|
||
|
|
||
|
if (length > 0)
|
||
|
free(array);
|
||
|
|
||
|
for (i = 0; i < LAYER_NUM; i++)
|
||
|
lyt->layer_destroy(ivilayers[i]);
|
||
|
|
||
|
#undef LAYER_NUM
|
||
|
}
|
||
|
|
||
7 years ago
|
static void
|
||
|
test_screen_remove_layer(struct test_context *ctx)
|
||
|
{
|
||
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
|
struct ivi_layout_layer *ivilayer;
|
||
|
struct weston_output *output;
|
||
|
struct ivi_layout_layer **array;
|
||
|
int32_t length = 0;
|
||
|
|
||
|
if (wl_list_empty(&ctx->compositor->output_list))
|
||
|
return;
|
||
|
|
||
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
|
iassert(ivilayer != NULL);
|
||
|
|
||
|
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||
|
|
||
|
iassert(lyt->screen_add_layer(output, ivilayer) == IVI_SUCCEEDED);
|
||
|
lyt->commit_changes();
|
||
|
|
||
|
iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
|
||
|
iassert(length == 1);
|
||
|
iassert(array[0] == ivilayer);
|
||
|
|
||
|
iassert(lyt->screen_remove_layer(output, ivilayer) == IVI_SUCCEEDED);
|
||
|
lyt->commit_changes();
|
||
|
|
||
|
if (length > 0)
|
||
|
free(array);
|
||
|
|
||
|
array = NULL;
|
||
|
|
||
|
iassert(lyt->get_layers_on_screen(output, &length, &array) == IVI_SUCCEEDED);
|
||
|
iassert(length == 0);
|
||
|
iassert(array == NULL);
|
||
|
|
||
|
lyt->layer_destroy(ivilayer);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
test_screen_bad_remove_layer(struct test_context *ctx)
|
||
|
{
|
||
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
|
struct ivi_layout_layer *ivilayer;
|
||
|
struct weston_output *output;
|
||
|
|
||
|
if (wl_list_empty(&ctx->compositor->output_list))
|
||
|
return;
|
||
|
|
||
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
|
iassert(ivilayer != NULL);
|
||
|
|
||
|
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||
|
|
||
|
iassert(lyt->screen_remove_layer(NULL, ivilayer) == IVI_FAILED);
|
||
|
lyt->commit_changes();
|
||
|
|
||
|
iassert(lyt->screen_remove_layer(output, NULL) == IVI_FAILED);
|
||
|
lyt->commit_changes();
|
||
|
|
||
|
iassert(lyt->screen_remove_layer(NULL, NULL) == IVI_FAILED);
|
||
|
lyt->commit_changes();
|
||
|
|
||
|
lyt->layer_destroy(ivilayer);
|
||
|
}
|
||
|
|
||
|
|
||
10 years ago
|
static void
|
||
|
test_commit_changes_after_render_order_set_layer_destroy(
|
||
|
struct test_context *ctx)
|
||
|
{
|
||
|
#define LAYER_NUM (3)
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
9 years ago
|
struct weston_output *output;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||
|
uint32_t i;
|
||
|
|
||
7 years ago
|
if (!iassert(!wl_list_empty(&ctx->compositor->output_list)))
|
||
10 years ago
|
return;
|
||
|
|
||
9 years ago
|
output = wl_container_of(ctx->compositor->output_list.next, output, link);
|
||
10 years ago
|
|
||
|
for (i = 0; i < LAYER_NUM; i++)
|
||
9 years ago
|
ivilayers[i] = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(i), 200, 300);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->screen_set_render_order(output, ivilayers, LAYER_NUM) == IVI_SUCCEEDED);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayers[1]);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayers[0]);
|
||
|
lyt->layer_destroy(ivilayers[2]);
|
||
10 years ago
|
#undef LAYER_NUM
|
||
|
}
|
||
|
|
||
10 years ago
|
static void
|
||
9 years ago
|
test_layer_properties_changed_notification_callback(struct wl_listener *listener, void *data)
|
||
10 years ago
|
{
|
||
9 years ago
|
struct test_context *ctx =
|
||
|
container_of(listener, struct test_context,
|
||
|
layer_property_changed);
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
9 years ago
|
struct ivi_layout_layer *ivilayer = data;
|
||
|
const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
|
||
10 years ago
|
iassert(prop->source_width == 200);
|
||
|
iassert(prop->source_height == 300);
|
||
|
|
||
9 years ago
|
if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
|
||
10 years ago
|
prop->source_width == 200 && prop->source_height == 300)
|
||
|
ctx->user_flags = 1;
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_properties_changed_notification(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
|
||
|
ctx->user_flags = 0;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
|
||
9 years ago
|
ctx->layer_property_changed.notify = test_layer_properties_changed_notification_callback;
|
||
|
|
||
|
iassert(lyt->layer_add_listener(ivilayer, &ctx->layer_property_changed) == IVI_SUCCEEDED);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
|
iassert(ctx->user_flags == 0);
|
||
|
|
||
9 years ago
|
iassert(lyt->layer_set_destination_rectangle(
|
||
10 years ago
|
ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
|
||
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
|
iassert(ctx->user_flags == 1);
|
||
|
|
||
|
ctx->user_flags = 0;
|
||
9 years ago
|
iassert(lyt->layer_set_destination_rectangle(
|
||
10 years ago
|
ivilayer, 20, 30, 200, 300) == IVI_SUCCEEDED);
|
||
|
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
|
iassert(ctx->user_flags == 0);
|
||
|
|
||
9 years ago
|
// remove layer property changed listener.
|
||
|
wl_list_remove(&ctx->layer_property_changed.link);
|
||
10 years ago
|
|
||
|
ctx->user_flags = 0;
|
||
9 years ago
|
lyt->commit_changes();
|
||
10 years ago
|
|
||
|
iassert(ctx->user_flags == 0);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
9 years ago
|
test_layer_create_notification_callback(struct wl_listener *listener, void *data)
|
||
10 years ago
|
{
|
||
9 years ago
|
struct test_context *ctx =
|
||
|
container_of(listener, struct test_context,
|
||
|
layer_created);
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
9 years ago
|
struct ivi_layout_layer *ivilayer = data;
|
||
9 years ago
|
const struct ivi_layout_layer_properties *prop = lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
|
||
10 years ago
|
iassert(prop->source_width == 200);
|
||
|
iassert(prop->source_height == 300);
|
||
|
|
||
9 years ago
|
if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
|
||
10 years ago
|
prop->source_width == 200 && prop->source_height == 300)
|
||
|
ctx->user_flags = 1;
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_create_notification(struct test_context *ctx)
|
||
|
{
|
||
|
#define LAYER_NUM (2)
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
|
||
|
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||
|
|
||
|
ctx->user_flags = 0;
|
||
9 years ago
|
ctx->layer_created.notify = test_layer_create_notification_callback;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->add_listener_create_layer(&ctx->layer_created) == IVI_SUCCEEDED);
|
||
9 years ago
|
ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
|
||
10 years ago
|
|
||
|
iassert(ctx->user_flags == 1);
|
||
|
|
||
|
ctx->user_flags = 0;
|
||
9 years ago
|
// remove layer created listener.
|
||
|
wl_list_remove(&ctx->layer_created.link);
|
||
10 years ago
|
|
||
9 years ago
|
ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 400, 500);
|
||
10 years ago
|
|
||
|
iassert(ctx->user_flags == 0);
|
||
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayers[0]);
|
||
|
lyt->layer_destroy(ivilayers[1]);
|
||
10 years ago
|
#undef LAYER_NUM
|
||
|
}
|
||
|
|
||
|
static void
|
||
9 years ago
|
test_layer_remove_notification_callback(struct wl_listener *listener, void *data)
|
||
10 years ago
|
{
|
||
9 years ago
|
struct test_context *ctx =
|
||
|
container_of(listener, struct test_context,
|
||
|
layer_removed);
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
9 years ago
|
struct ivi_layout_layer *ivilayer = data;
|
||
10 years ago
|
const struct ivi_layout_layer_properties *prop =
|
||
9 years ago
|
lyt->get_properties_of_layer(ivilayer);
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0));
|
||
10 years ago
|
iassert(prop->source_width == 200);
|
||
|
iassert(prop->source_height == 300);
|
||
|
|
||
9 years ago
|
if (lyt->get_id_of_layer(ivilayer) == IVI_TEST_LAYER_ID(0) &&
|
||
10 years ago
|
prop->source_width == 200 && prop->source_height == 300)
|
||
|
ctx->user_flags = 1;
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_remove_notification(struct test_context *ctx)
|
||
|
{
|
||
|
#define LAYER_NUM (2)
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
static const uint32_t layers[LAYER_NUM] = {IVI_TEST_LAYER_ID(0), IVI_TEST_LAYER_ID(1)};
|
||
|
struct ivi_layout_layer *ivilayers[LAYER_NUM] = {};
|
||
|
|
||
|
ctx->user_flags = 0;
|
||
9 years ago
|
ctx->layer_removed.notify = test_layer_remove_notification_callback;
|
||
10 years ago
|
|
||
9 years ago
|
ivilayers[0] = lyt->layer_create_with_dimension(layers[0], 200, 300);
|
||
9 years ago
|
iassert(lyt->add_listener_remove_layer(&ctx->layer_removed) == IVI_SUCCEEDED);
|
||
9 years ago
|
lyt->layer_destroy(ivilayers[0]);
|
||
10 years ago
|
|
||
|
iassert(ctx->user_flags == 1);
|
||
|
|
||
|
ctx->user_flags = 0;
|
||
9 years ago
|
ivilayers[1] = lyt->layer_create_with_dimension(layers[1], 250, 350);
|
||
9 years ago
|
|
||
|
// remove layer property changed listener.
|
||
|
wl_list_remove(&ctx->layer_removed.link);
|
||
9 years ago
|
lyt->layer_destroy(ivilayers[1]);
|
||
10 years ago
|
|
||
|
iassert(ctx->user_flags == 0);
|
||
|
#undef LAYER_NUM
|
||
|
}
|
||
|
|
||
10 years ago
|
static void
|
||
9 years ago
|
test_layer_bad_properties_changed_notification_callback(struct wl_listener *listener, void *data)
|
||
10 years ago
|
{
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_bad_properties_changed_notification(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
struct ivi_layout_layer *ivilayer;
|
||
|
|
||
9 years ago
|
ivilayer = lyt->layer_create_with_dimension(IVI_TEST_LAYER_ID(0), 200, 300);
|
||
10 years ago
|
|
||
9 years ago
|
ctx->layer_property_changed.notify = test_layer_bad_properties_changed_notification_callback;
|
||
|
|
||
|
iassert(lyt->layer_add_listener(NULL, &ctx->layer_property_changed) == IVI_FAILED);
|
||
|
iassert(lyt->layer_add_listener(ivilayer, NULL) == IVI_FAILED);
|
||
10 years ago
|
|
||
9 years ago
|
lyt->layer_destroy(ivilayer);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_surface_bad_configure_notification(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->add_listener_configure_surface(NULL) == IVI_FAILED);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_bad_create_notification(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->add_listener_create_layer(NULL) == IVI_FAILED);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_surface_bad_create_notification(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->add_listener_create_surface(NULL) == IVI_FAILED);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_layer_bad_remove_notification(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->add_listener_remove_layer(NULL) == IVI_FAILED);
|
||
10 years ago
|
}
|
||
|
|
||
|
static void
|
||
|
test_surface_bad_remove_notification(struct test_context *ctx)
|
||
|
{
|
||
9 years ago
|
const struct ivi_layout_interface *lyt = ctx->layout_interface;
|
||
10 years ago
|
|
||
9 years ago
|
iassert(lyt->add_listener_remove_surface(NULL) == IVI_FAILED);
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
/************************ tests end ********************************/
|
||
|
|
||
|
static void
|
||
|
run_internal_tests(void *data)
|
||
|
{
|
||
|
struct test_context *ctx = data;
|
||
|
|
||
|
test_surface_bad_visibility(ctx);
|
||
10 years ago
|
test_surface_bad_destination_rectangle(ctx);
|
||
|
test_surface_bad_source_rectangle(ctx);
|
||
|
test_surface_bad_properties(ctx);
|
||
10 years ago
|
|
||
10 years ago
|
test_layer_create(ctx);
|
||
|
test_layer_visibility(ctx);
|
||
|
test_layer_opacity(ctx);
|
||
|
test_layer_dimension(ctx);
|
||
|
test_layer_position(ctx);
|
||
|
test_layer_destination_rectangle(ctx);
|
||
|
test_layer_source_rectangle(ctx);
|
||
10 years ago
|
test_layer_bad_remove(ctx);
|
||
|
test_layer_bad_visibility(ctx);
|
||
|
test_layer_bad_opacity(ctx);
|
||
|
test_layer_bad_destination_rectangle(ctx);
|
||
|
test_layer_bad_source_rectangle(ctx);
|
||
|
test_layer_bad_properties(ctx);
|
||
|
test_commit_changes_after_visibility_set_layer_destroy(ctx);
|
||
|
test_commit_changes_after_opacity_set_layer_destroy(ctx);
|
||
|
test_commit_changes_after_source_rectangle_set_layer_destroy(ctx);
|
||
|
test_commit_changes_after_destination_rectangle_set_layer_destroy(ctx);
|
||
|
test_layer_create_duplicate(ctx);
|
||
|
test_get_layer_after_destory_layer(ctx);
|
||
10 years ago
|
|
||
10 years ago
|
test_screen_render_order(ctx);
|
||
10 years ago
|
test_screen_bad_render_order(ctx);
|
||
8 years ago
|
test_screen_add_layers(ctx);
|
||
7 years ago
|
test_screen_remove_layer(ctx);
|
||
|
test_screen_bad_remove_layer(ctx);
|
||
10 years ago
|
test_commit_changes_after_render_order_set_layer_destroy(ctx);
|
||
|
|
||
10 years ago
|
test_layer_properties_changed_notification(ctx);
|
||
|
test_layer_create_notification(ctx);
|
||
|
test_layer_remove_notification(ctx);
|
||
10 years ago
|
test_layer_bad_properties_changed_notification(ctx);
|
||
|
test_surface_bad_configure_notification(ctx);
|
||
|
test_layer_bad_create_notification(ctx);
|
||
|
test_surface_bad_create_notification(ctx);
|
||
|
test_layer_bad_remove_notification(ctx);
|
||
|
test_surface_bad_remove_notification(ctx);
|
||
10 years ago
|
|
||
10 years ago
|
weston_compositor_exit_with_code(ctx->compositor, EXIT_SUCCESS);
|
||
|
free(ctx);
|
||
|
}
|
||
|
|
||
|
WL_EXPORT int
|
||
7 years ago
|
wet_module_init(struct weston_compositor *compositor,
|
||
|
int *argc, char *argv[])
|
||
10 years ago
|
{
|
||
|
struct wl_event_loop *loop;
|
||
|
struct test_context *ctx;
|
||
7 years ago
|
const struct ivi_layout_interface *iface;
|
||
|
|
||
|
iface = ivi_layout_get_api(compositor);
|
||
10 years ago
|
|
||
7 years ago
|
if (!iface) {
|
||
|
weston_log("fatal: cannot use ivi_layout_interface.\n");
|
||
10 years ago
|
return -1;
|
||
|
}
|
||
|
|
||
|
ctx = zalloc(sizeof(*ctx));
|
||
|
if (!ctx)
|
||
|
return -1;
|
||
|
|
||
|
ctx->compositor = compositor;
|
||
9 years ago
|
ctx->layout_interface = iface;
|
||
10 years ago
|
|
||
|
loop = wl_display_get_event_loop(compositor->wl_display);
|
||
|
wl_event_loop_add_idle(loop, run_internal_tests, ctx);
|
||
|
|
||
|
return 0;
|
||
|
}
|