diff --git a/tests/builder.test.cpp b/tests/builder.test.cpp index 8659693..f5f400b 100644 --- a/tests/builder.test.cpp +++ b/tests/builder.test.cpp @@ -14,6 +14,7 @@ #include #include #include +#include using namespace std; namespace fs = std::filesystem; @@ -94,6 +95,7 @@ TEST_P(SimplePathSignTest, SignsFileTypes) { fs::path manifest_path = current_dir / "../tests/fixtures/training.json"; fs::path certs_path = current_dir / "../tests/fixtures/es256_certs.pem"; fs::path asset_path = current_dir / "../tests/fixtures" / SimplePathSignTest::GetParam(); + fs::path ingredient_path = current_dir / "../tests/fixtures/A.jpg"; fs::path output_path = current_dir / "../build/example" / SimplePathSignTest::GetParam(); std::filesystem::remove(output_path.c_str()); // remove the file if it exists @@ -106,6 +108,14 @@ TEST_P(SimplePathSignTest, SignsFileTypes) { auto signer = c2pa::Signer("Es256", certs, p_key, "http://timestamp.digicert.com"); auto builder = c2pa::Builder(manifest); + // Add an ingredient example. + string ingredient_json = c2pa::read_ingredient_file(ingredient_path, output_path.parent_path()); + auto ingredient_json_obj = nlohmann::json::parse(ingredient_json); + std::string resource_id = ingredient_json_obj["thumbnail"]["identifier"]; + + builder.add_resource(resource_id, ingredient_path); + builder.add_ingredient(ingredient_json, ingredient_path); + std::vector manifest_data; ASSERT_NO_THROW(manifest_data = builder.sign(asset_path, output_path, signer)); ASSERT_FALSE(manifest_data.empty());