Skip to content

Commit

Permalink
fix modified API in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Aug 23, 2024
1 parent 2813600 commit 315a3bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libheif/pixelimage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ Result<std::shared_ptr<HeifPixelImage>> HeifPixelImage::rotate_ccw(int angle_deg
out_img->set_color_profile_nclx(get_color_profile_nclx());
out_img->set_color_profile_icc(get_color_profile_icc());

return Error::Ok;
return out_img;
}

template<typename T>
Expand Down
14 changes: 9 additions & 5 deletions tests/pixel_data_types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ TEST_CASE( "uint32_t" )
// --- rotate data

std::shared_ptr<HeifPixelImage> rot;
Error err = image.rotate_ccw(90, rot);
auto rotationResult = image.rotate_ccw(90);
REQUIRE(rotationResult.error.error_code == heif_error_Ok);
rot = rotationResult.value;

data = rot->get_channel<uint32_t>(heif_channel_other_first, &stride);

Expand Down Expand Up @@ -91,8 +93,9 @@ TEST_CASE( "uint32_t" )
// --- crop

std::shared_ptr<HeifPixelImage> crop;
err = image.crop(1,2,1,1, crop);
REQUIRE(!err);
auto cropResult = image.crop(1,2,1,1);
REQUIRE(cropResult.error.error_code == heif_error_Ok);
crop = cropResult.value;

REQUIRE(crop->get_width(heif_channel_other_first) == 2);
REQUIRE(crop->get_height(heif_channel_other_first) == 1);
Expand All @@ -102,8 +105,9 @@ TEST_CASE( "uint32_t" )
REQUIRE(data[0*stride + 0] == 0);
REQUIRE(data[0*stride + 1] == 2000);

err = image.crop(0,1,0,1, crop);
REQUIRE(!err);
cropResult = image.crop(0,1,0,1);
REQUIRE(cropResult.error.error_code == heif_error_Ok);
crop = cropResult.value;

REQUIRE(crop->get_width(heif_channel_other_first) == 2);
REQUIRE(crop->get_height(heif_channel_other_first) == 2);
Expand Down

0 comments on commit 315a3bc

Please sign in to comment.