Add PPI layer metadata save automation
This commit is contained in:
@@ -392,6 +392,7 @@ void creates_minimal_project_for_roundtrip_load(pp::tests::Harness& h)
|
||||
.width = 256,
|
||||
.height = 128,
|
||||
.layer_name = "Roundtrip",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 1,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 333,
|
||||
@@ -419,6 +420,12 @@ void creates_minimal_project_with_multiple_layers(pp::tests::Harness& h)
|
||||
.width = 256,
|
||||
.height = 128,
|
||||
.layer_name = "Layer",
|
||||
.layer_metadata = pp::assets::PpiLayerMetadataConfig {
|
||||
.opacity = 0.625F,
|
||||
.blend_mode = 4,
|
||||
.alpha_locked = true,
|
||||
.visible = false,
|
||||
},
|
||||
.layer_count = 2,
|
||||
.frame_count = 2,
|
||||
.frame_duration_ms = 111,
|
||||
@@ -436,6 +443,14 @@ void creates_minimal_project_with_multiple_layers(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, index.value().body.layers[1].stored_order == 1U);
|
||||
PP_EXPECT(h, index.value().body.layers[0].name == "Layer 1");
|
||||
PP_EXPECT(h, index.value().body.layers[1].name == "Layer 2");
|
||||
PP_EXPECT(h, index.value().body.layers[0].opacity == 0.625F);
|
||||
PP_EXPECT(h, index.value().body.layers[1].opacity == 0.625F);
|
||||
PP_EXPECT(h, index.value().body.layers[0].blend_mode == 4U);
|
||||
PP_EXPECT(h, index.value().body.layers[1].blend_mode == 4U);
|
||||
PP_EXPECT(h, index.value().body.layers[0].alpha_locked);
|
||||
PP_EXPECT(h, index.value().body.layers[1].alpha_locked);
|
||||
PP_EXPECT(h, !index.value().body.layers[0].visible);
|
||||
PP_EXPECT(h, !index.value().body.layers[1].visible);
|
||||
PP_EXPECT(h, index.value().body.layers[0].frames.size() == 2U);
|
||||
PP_EXPECT(h, index.value().body.layers[1].frames.size() == 2U);
|
||||
PP_EXPECT(h, index.value().body.layers[0].frames[1].duration_ms == 111U);
|
||||
@@ -448,6 +463,7 @@ void creates_minimal_project_with_multiple_frames(pp::tests::Harness& h)
|
||||
.width = 256,
|
||||
.height = 128,
|
||||
.layer_name = "Frames",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 1,
|
||||
.frame_count = 3,
|
||||
.frame_duration_ms = 111,
|
||||
@@ -482,6 +498,7 @@ void creates_minimal_project_with_dirty_face_payload(pp::tests::Harness& h)
|
||||
.width = 256,
|
||||
.height = 128,
|
||||
.layer_name = "Payload",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 1,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 333,
|
||||
@@ -528,6 +545,7 @@ void rejects_invalid_minimal_project_writer_inputs(pp::tests::Harness& h)
|
||||
.width = 0,
|
||||
.height = 128,
|
||||
.layer_name = "Ink",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 1,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 100,
|
||||
@@ -537,6 +555,7 @@ void rejects_invalid_minimal_project_writer_inputs(pp::tests::Harness& h)
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.layer_name = "",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 1,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 100,
|
||||
@@ -546,6 +565,7 @@ void rejects_invalid_minimal_project_writer_inputs(pp::tests::Harness& h)
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.layer_name = "Ink",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 1,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 0,
|
||||
@@ -555,6 +575,7 @@ void rejects_invalid_minimal_project_writer_inputs(pp::tests::Harness& h)
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.layer_name = "Ink",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 1,
|
||||
.frame_count = 0,
|
||||
.frame_duration_ms = 100,
|
||||
@@ -564,15 +585,41 @@ void rejects_invalid_minimal_project_writer_inputs(pp::tests::Harness& h)
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.layer_name = "Ink",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 0,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 100,
|
||||
.dirty_faces = {},
|
||||
});
|
||||
const auto bad_opacity = create_minimal_ppi_project(pp::assets::PpiMinimalProjectConfig {
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.layer_name = "Ink",
|
||||
.layer_metadata = pp::assets::PpiLayerMetadataConfig {
|
||||
.opacity = 1.25F,
|
||||
},
|
||||
.layer_count = 1,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 100,
|
||||
.dirty_faces = {},
|
||||
});
|
||||
const auto bad_blend_mode = create_minimal_ppi_project(pp::assets::PpiMinimalProjectConfig {
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.layer_name = "Ink",
|
||||
.layer_metadata = pp::assets::PpiLayerMetadataConfig {
|
||||
.blend_mode = 99,
|
||||
},
|
||||
.layer_count = 1,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 100,
|
||||
.dirty_faces = {},
|
||||
});
|
||||
const auto duplicate_dirty_face = create_minimal_ppi_project(pp::assets::PpiMinimalProjectConfig {
|
||||
.width = 128,
|
||||
.height = 128,
|
||||
.layer_name = "Ink",
|
||||
.layer_metadata = {},
|
||||
.layer_count = 1,
|
||||
.frame_count = 1,
|
||||
.frame_duration_ms = 100,
|
||||
@@ -589,6 +636,10 @@ void rejects_invalid_minimal_project_writer_inputs(pp::tests::Harness& h)
|
||||
PP_EXPECT(h, no_frames.status().code == StatusCode::out_of_range);
|
||||
PP_EXPECT(h, !no_layers.ok());
|
||||
PP_EXPECT(h, no_layers.status().code == StatusCode::out_of_range);
|
||||
PP_EXPECT(h, !bad_opacity.ok());
|
||||
PP_EXPECT(h, bad_opacity.status().code == StatusCode::out_of_range);
|
||||
PP_EXPECT(h, !bad_blend_mode.ok());
|
||||
PP_EXPECT(h, bad_blend_mode.status().code == StatusCode::out_of_range);
|
||||
PP_EXPECT(h, !duplicate_dirty_face.ok());
|
||||
PP_EXPECT(h, duplicate_dirty_face.status().code == StatusCode::invalid_argument);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user