mirror of
https://github.com/lvgl/lvgl.git
synced 2026-09-26 17:55:55 +08:00
test(gltf): remove invalid params tests
This commit is contained in:
@@ -62,30 +62,6 @@ void test_gltf_animation_play_selects_the_animation(void)
|
||||
lv_gltf_model_delete(model);
|
||||
}
|
||||
|
||||
void test_gltf_animation_play_out_of_range_fails(void)
|
||||
{
|
||||
lv_gltf_model_t * model = load_animated();
|
||||
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_play_animation(model, ANIMATION_COUNT));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_play_animation(model, 1000));
|
||||
|
||||
/* A failed selection leaves the state alone */
|
||||
TEST_ASSERT_TRUE(lv_gltf_model_is_animation_paused(model));
|
||||
|
||||
lv_gltf_model_delete(model);
|
||||
}
|
||||
|
||||
void test_gltf_animation_play_without_animations_fails(void)
|
||||
{
|
||||
lv_gltf_model_t * model = lv_gltf_data_load_from_file(ASSET("minimal_triangle.gltf"), NULL);
|
||||
TEST_ASSERT_NOT_NULL(model);
|
||||
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_play_animation(model, 0));
|
||||
TEST_ASSERT_TRUE(lv_gltf_model_is_animation_paused(model));
|
||||
|
||||
lv_gltf_model_delete(model);
|
||||
}
|
||||
|
||||
void test_gltf_animation_pause_and_resume(void)
|
||||
{
|
||||
lv_gltf_model_t * model = load_animated();
|
||||
@@ -207,14 +183,6 @@ void test_gltf_animation_play_selects_the_animation(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_animation_play_out_of_range_fails(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_animation_play_without_animations_fails(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_animation_pause_and_resume(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -131,12 +131,6 @@ void test_gltf_environment_create_from_missing_file_falls_back(void)
|
||||
lv_gltf_ibl_sampler_delete(sampler);
|
||||
}
|
||||
|
||||
/* A NULL sampler is refused */
|
||||
void test_gltf_environment_create_without_sampler_fails(void)
|
||||
{
|
||||
TEST_ASSERT_NULL(lv_gltf_environment_create(NULL, NULL));
|
||||
}
|
||||
|
||||
/* The environment image really is taken from the file: the same model lit by the
|
||||
* generated image does not look like the one lit by the embedded default image */
|
||||
void test_gltf_environment_image_is_used(void)
|
||||
@@ -240,18 +234,6 @@ void test_gltf_environment_replace_after_load(void)
|
||||
lv_gltf_environment_delete(env);
|
||||
}
|
||||
|
||||
/* A NULL environment is refused instead of leaving the viewer without one */
|
||||
void test_gltf_environment_set_null_is_refused(void)
|
||||
{
|
||||
lv_obj_t * gltf = create_view(0);
|
||||
TEST_ASSERT_NOT_NULL(lv_gltf_load_model_from_file(gltf, ASSET("minimal_triangle.gltf")));
|
||||
|
||||
lv_gltf_set_environment(gltf, NULL);
|
||||
|
||||
/* Rendering still works, so the viewer kept its environment */
|
||||
render_frames();
|
||||
}
|
||||
|
||||
/* Rotating the environment rotates the lighting of the model */
|
||||
void test_gltf_environment_angle_is_applied(void)
|
||||
{
|
||||
@@ -312,10 +294,6 @@ void test_gltf_environment_create_from_missing_file_falls_back(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_environment_create_without_sampler_fails(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_environment_image_is_used(void)
|
||||
{
|
||||
}
|
||||
@@ -336,10 +314,6 @@ void test_gltf_environment_replace_after_load(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_environment_set_null_is_refused(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_environment_angle_is_applied(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -196,16 +196,6 @@ void test_gltf_model_counts_skin_asset(void)
|
||||
lv_gltf_model_delete(model);
|
||||
}
|
||||
|
||||
/* The count getters assert on a NULL model, but the functions that document a NULL
|
||||
* check must tolerate it. */
|
||||
void test_gltf_model_null_tolerant_functions(void)
|
||||
{
|
||||
lv_gltf_model_delete(NULL);
|
||||
lv_gltf_model_set_animation_speed(NULL, LV_GLTF_ANIM_SPEED_2X);
|
||||
TEST_ASSERT_EQUAL(0, lv_gltf_model_get_animation_speed(NULL));
|
||||
lv_gltf_model_loader_delete(NULL);
|
||||
}
|
||||
|
||||
/* A loader can be reused for several models. Its texture cache is what makes shared
|
||||
* images load once, so models loaded through the same loader stay independent. */
|
||||
void test_gltf_model_shared_loader(void)
|
||||
@@ -331,10 +321,6 @@ void test_gltf_model_counts_skin_asset(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_model_null_tolerant_functions(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_model_shared_loader(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -80,11 +80,6 @@ void test_gltf_node_get_by_index(void)
|
||||
TEST_ASSERT_NOT_NULL(lv_gltf_model_node_get_by_index(model, i));
|
||||
}
|
||||
|
||||
/* One past the last node and far beyond it are both out of range */
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_index(model, 7));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_index(model, 1000));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_index(NULL, 0));
|
||||
|
||||
lv_gltf_model_delete(model);
|
||||
}
|
||||
|
||||
@@ -106,7 +101,6 @@ void test_gltf_node_get_by_path(void)
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_path(model, "/body/nope"));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_path(model, "body"));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_path(model, ""));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_path(NULL, "/body"));
|
||||
|
||||
lv_gltf_model_delete(model);
|
||||
}
|
||||
@@ -131,7 +125,6 @@ void test_gltf_node_get_by_numeric_path(void)
|
||||
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_numeric_path(model, ".9"));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_numeric_path(model, "0"));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_by_numeric_path(NULL, ".0"));
|
||||
|
||||
lv_gltf_model_delete(model);
|
||||
}
|
||||
@@ -151,9 +144,6 @@ void test_gltf_node_paths_round_trip(void)
|
||||
TEST_ASSERT_EQUAL_PTR(node, lv_gltf_model_node_get_by_numeric_path(model, numeric_path));
|
||||
}
|
||||
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_path(NULL));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_get_ip(NULL));
|
||||
|
||||
lv_gltf_model_delete(model);
|
||||
}
|
||||
|
||||
@@ -283,17 +273,6 @@ void test_gltf_node_read_world_position(void)
|
||||
TEST_ASSERT_FLOAT_WITHIN(0.001f, 3.0f, report.world_position.z);
|
||||
}
|
||||
|
||||
/* Reading a property outside of the callback must fail instead of handing out stale data */
|
||||
void test_gltf_node_read_outside_callback_fails(void)
|
||||
{
|
||||
lv_3dpoint_t point;
|
||||
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_get_local_position(NULL, &point));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_get_world_position(NULL, &point));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_get_scale(NULL, &point));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_get_euler_rotation(NULL, &point));
|
||||
}
|
||||
|
||||
void test_gltf_node_set_position(void)
|
||||
{
|
||||
lv_gltf_model_t * model = NULL;
|
||||
@@ -388,23 +367,6 @@ void test_gltf_node_parent_transform_affects_child(void)
|
||||
TEST_ASSERT_FLOAT_WITHIN(0.001f, 11.0f + 0.5f + 0.25f * 2.0f, report.world_position.x);
|
||||
}
|
||||
|
||||
void test_gltf_node_setters_reject_null(void)
|
||||
{
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_position_x(NULL, 1.0f));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_position_y(NULL, 1.0f));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_position_z(NULL, 1.0f));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_rotation_x(NULL, 1.0f));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_rotation_y(NULL, 1.0f));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_rotation_z(NULL, 1.0f));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_scale_x(NULL, 1.0f));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_scale_y(NULL, 1.0f));
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_model_node_set_scale_z(NULL, 1.0f));
|
||||
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_add_event_cb(NULL, node_value_cb, LV_EVENT_VALUE_CHANGED, NULL));
|
||||
TEST_ASSERT_NULL(lv_gltf_model_node_add_event_cb_with_world_position(NULL, node_value_cb,
|
||||
LV_EVENT_VALUE_CHANGED, NULL));
|
||||
}
|
||||
|
||||
/* The callback is only called when a property actually changed */
|
||||
void test_gltf_node_event_only_on_change(void)
|
||||
{
|
||||
@@ -501,10 +463,6 @@ void test_gltf_node_read_world_position(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_node_read_outside_callback_fails(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_node_set_position(void)
|
||||
{
|
||||
}
|
||||
@@ -521,10 +479,6 @@ void test_gltf_node_parent_transform_affects_child(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_node_setters_reject_null(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_node_event_only_on_change(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -301,7 +301,6 @@ void test_gltf_viewer_remove_model_tolerates_unknown_models(void)
|
||||
TEST_ASSERT_NOT_NULL(other);
|
||||
|
||||
lv_gltf_remove_model(first, other);
|
||||
lv_gltf_remove_model(first, NULL);
|
||||
|
||||
TEST_ASSERT_EQUAL(1, lv_gltf_get_model_count(first));
|
||||
TEST_ASSERT_EQUAL(1, lv_gltf_get_model_count(second));
|
||||
@@ -313,14 +312,6 @@ void test_gltf_viewer_remove_model_tolerates_unknown_models(void)
|
||||
TEST_ASSERT_EQUAL(1, lv_gltf_get_model_count(second));
|
||||
}
|
||||
|
||||
void test_gltf_viewer_add_model_rejects_null(void)
|
||||
{
|
||||
lv_obj_t * gltf = create_view();
|
||||
|
||||
TEST_ASSERT_EQUAL(LV_RESULT_INVALID, lv_gltf_add_model(gltf, NULL));
|
||||
TEST_ASSERT_EQUAL(0, lv_gltf_get_model_count(gltf));
|
||||
}
|
||||
|
||||
void test_gltf_viewer_camera_selection(void)
|
||||
{
|
||||
lv_obj_t * gltf = create_view();
|
||||
@@ -360,15 +351,6 @@ void test_gltf_viewer_camera_count_without_cameras(void)
|
||||
}
|
||||
|
||||
/* The camera of a viewer without models cannot be changed */
|
||||
void test_gltf_viewer_camera_without_model(void)
|
||||
{
|
||||
lv_obj_t * gltf = create_view();
|
||||
|
||||
TEST_ASSERT_EQUAL(0, lv_gltf_get_camera_count(gltf));
|
||||
lv_gltf_set_camera(gltf, 1);
|
||||
TEST_ASSERT_EQUAL(LV_GLTF_DEFAULT_CAMERA, lv_gltf_get_camera(gltf));
|
||||
}
|
||||
|
||||
void test_gltf_viewer_camera_orientation(void)
|
||||
{
|
||||
lv_obj_t * gltf = create_view();
|
||||
@@ -629,10 +611,6 @@ void test_gltf_viewer_delete_a_shared_model(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_viewer_add_model_rejects_null(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_viewer_camera_selection(void)
|
||||
{
|
||||
}
|
||||
@@ -641,10 +619,6 @@ void test_gltf_viewer_camera_count_without_cameras(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_viewer_camera_without_model(void)
|
||||
{
|
||||
}
|
||||
|
||||
void test_gltf_viewer_camera_orientation(void)
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user