Share recorded document upload reporting

This commit is contained in:
2026-06-05 18:46:15 +02:00
parent 81898a5dcc
commit 693923b7bd
8 changed files with 141 additions and 63 deletions

View File

@@ -541,6 +541,62 @@ void uploads_document_frame_faces_to_renderer_api(pp::tests::Harness& h)
PP_EXPECT(h, transition_count == pp::document::cube_face_count);
}
void records_document_frame_upload_report(pp::tests::Harness& h)
{
const AnimationFrame root_frames[] {
{ .duration_ms = 100, .face_pixels = {} },
};
const AnimationFrame layer_frames[] {
{
.duration_ms = 100,
.face_pixels = {
LayerFacePixels {
.face_index = 1,
.x = 0,
.y = 0,
.width = 1,
.height = 1,
.rgba8 = { 0, 0, 255, 255 },
},
},
},
};
const DocumentLayerConfig layers[] {
{
.name = "Paint",
.frames = std::span<const AnimationFrame>(layer_frames, 1),
},
};
const auto document = CanvasDocument::create_from_snapshot(DocumentSnapshotConfig {
.width = 1,
.height = 1,
.layers = std::span<const DocumentLayerConfig>(layers, 1),
.frames = std::span<const AnimationFrame>(root_frames, 1),
.selection_masks = {},
});
PP_EXPECT(h, document);
if (!document) {
return;
}
const auto report = pp::paint_renderer::record_document_frame_upload(
pp::paint_renderer::DocumentFrameUploadRequest {
.document = &document.value(),
.frame_index = 0,
});
PP_EXPECT(h, report);
if (report) {
PP_EXPECT(h, report.value().upload.texture_count == pp::document::cube_face_count);
PP_EXPECT(h, report.value().upload.transition_count == pp::document::cube_face_count);
PP_EXPECT(h, report.value().upload.uploaded_bytes == 24U);
PP_EXPECT(h, report.value().upload.composite.face_payload_count == 1U);
PP_EXPECT(h, report.value().command_count == 12U);
PP_EXPECT(h, report.value().upload_command_count == pp::document::cube_face_count);
PP_EXPECT(h, report.value().transition_command_count == pp::document::cube_face_count);
}
}
void document_frame_upload_rejects_invalid_requests(pp::tests::Harness& h)
{
RecordingRenderDevice device;
@@ -922,6 +978,7 @@ int main()
harness.run("composites_document_frame_cube_faces", composites_document_frame_cube_faces);
harness.run("document_frame_composite_rejects_invalid_requests", document_frame_composite_rejects_invalid_requests);
harness.run("uploads_document_frame_faces_to_renderer_api", uploads_document_frame_faces_to_renderer_api);
harness.run("records_document_frame_upload_report", records_document_frame_upload_report);
harness.run("document_frame_upload_rejects_invalid_requests", document_frame_upload_rejects_invalid_requests);
harness.run("detects_feedback_requirements", detects_feedback_requirements);
harness.run("plans_stroke_composite_paths", plans_stroke_composite_paths);