Skip to content

Commit

Permalink
Prepare release.
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot-abi committed Jul 23, 2024
1 parent 3e45a6a commit d20d55f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CHANGE LOG: Zinc Library

v4.1.2
Fix bug with loading images with that have a depth that are not integrals of a byte.

v4.1.1
Fix empty classifiers for Python packaging.
Drop support for OS X Mountain Lion and below (last released 2015).
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if(POLICY CMP0086)
endif()

# This is the project name and shows up in IDEs
project(Zinc VERSION 4.1.1 LANGUAGES C CXX)
project(Zinc VERSION 4.1.2 LANGUAGES C CXX)

# Set this to the development release or release candidate version.
set(Zinc_DEVELOPER_VERSION "")
Expand Down
2 changes: 1 addition & 1 deletion src/general/image_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5642,7 +5642,7 @@ Extracts parameters from <magick_image> that matter for a Cmgui_image
*number_of_components = 3;
}
}
*number_of_bytes_per_component = magick_image->depth/8;
*number_of_bytes_per_component = (magick_image->depth + 7) / 8;
DestroyExceptionInfo(magick_exception);
return_code = 1;
}
Expand Down
35 changes: 27 additions & 8 deletions tests/image/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,38 @@ TEST(cmzn_fieldmodule_create_image, read_png)

TEST(ZincFieldImage, read_png)
{
ZincTestSetupCpp zinc;
ZincTestSetupCpp zinc;

FieldImage im = zinc.fm.createFieldImage();
EXPECT_TRUE(im.isValid());
FieldImage im = zinc.fm.createFieldImage();
EXPECT_TRUE(im.isValid());

StreaminformationImage si = im.createStreaminformationImage();
EXPECT_TRUE(si.isValid());
StreaminformationImage si = im.createStreaminformationImage();
EXPECT_TRUE(si.isValid());

std::string resource = resourcePath("image-1.png");
Streamresource sr = si.createStreamresourceFile(resource.c_str());
EXPECT_TRUE(sr.isValid());
EXPECT_TRUE(sr.isValid());

EXPECT_EQ(CMZN_OK, im.read(si));
}

TEST(ZincFieldImage, read_png_1_bit_depth)
{
ZincTestSetupCpp zinc;

FieldImage im = zinc.fm.createFieldImage();
EXPECT_TRUE(im.isValid());

StreaminformationImage si = im.createStreaminformationImage();
EXPECT_TRUE(si.isValid());

std::string resource = resourcePath("AWA015_PTA_1_test.png");
Streamresource sr = si.createStreamresourceFile(resource.c_str());
EXPECT_TRUE(sr.isValid());

EXPECT_EQ(CMZN_OK, im.read(si));

EXPECT_EQ(CMZN_OK, im.read(si));
EXPECT_EQ(8, im.getNumberOfBitsPerComponent());
}

TEST(ZincFieldImage, set_get_buffer)
Expand All @@ -106,7 +125,7 @@ TEST(ZincFieldImage, set_get_buffer)
int myArray[3] = {4,3,2};
EXPECT_EQ(CMZN_OK, im.setSizeInPixels(3, myArray));

unsigned int actualSize = 4 *3 * 2 * 2;
unsigned int actualSize = 4 * 3 * 2 * 2;
unsigned char *buffer = new unsigned char[actualSize];
for (unsigned int i = 0; i < actualSize; i++)
{
Expand Down
Binary file added tests/resources/AWA015_PTA_1_test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d20d55f

Please sign in to comment.