[gexiv2/wip/fix-metadata-pixelsize: 2/3] metadata: Use proper exif for reading height
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gexiv2/wip/fix-metadata-pixelsize: 2/3] metadata: Use proper exif for reading height
- Date: Tue, 23 Oct 2018 20:30:52 +0000 (UTC)
commit 297dd7da68869acd261a2a745d200e4768caeade
Author: Jens Georg <mail jensge org>
Date: Tue Oct 23 16:08:39 2018 +0200
metadata: Use proper exif for reading height
As for the previous commit, the proper tag to read is
Exif.Image.ImageLength for the image height.
Fixes #32
gexiv2/gexiv2-metadata.cpp | 4 ++--
test/gexiv2-regression.c | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+), 2 deletions(-)
---
diff --git a/gexiv2/gexiv2-metadata.cpp b/gexiv2/gexiv2-metadata.cpp
index 1d38707..8823651 100644
--- a/gexiv2/gexiv2-metadata.cpp
+++ b/gexiv2/gexiv2-metadata.cpp
@@ -534,8 +534,8 @@ gint gexiv2_metadata_get_metadata_pixel_height (GExiv2Metadata *self) {
if (gexiv2_metadata_has_exif_tag(self, "Exif.Photo.PixelYDimension"))
return gexiv2_metadata_get_exif_tag_long(self, "Exif.Photo.PixelYDimension");
- if (gexiv2_metadata_has_exif_tag(self, "Exif.Image.ImageHeight"))
- return gexiv2_metadata_get_exif_tag_long(self, "Exif.Image.ImageHeight");
+ if (gexiv2_metadata_has_exif_tag(self, "Exif.Image.ImageLength"))
+ return gexiv2_metadata_get_exif_tag_long(self, "Exif.Image.ImageLength");
}
if (gexiv2_metadata_has_xmp(self)) {
diff --git a/test/gexiv2-regression.c b/test/gexiv2-regression.c
index bfb67ae..3b174a8 100644
--- a/test/gexiv2-regression.c
+++ b/test/gexiv2-regression.c
@@ -32,6 +32,29 @@ static void test_ggo_31(void)
g_clear_object(&meta);
}
+/* Regression test for https://gitlab.gnome.org/GNOME/gexiv2/issues/32 */
+static void test_ggo_32 (void)
+{
+ GExiv2Metadata *meta = NULL;
+ gboolean result = FALSE;
+ GError *error = NULL;
+ gint pixel_height = 0;
+
+ meta = gexiv2_metadata_new();
+ g_assert_nonnull(meta);
+
+ result = gexiv2_metadata_open_path (meta, SAMPLE_PATH "/no-metadata.jpg", &error);
+ g_assert_no_error(error);
+ g_assert_true(result);
+
+ gexiv2_metadata_set_tag_long(meta, "Exif.Image.ImageLength", 1234);
+
+ pixel_height = gexiv2_metadata_get_metadata_pixel_height(meta);
+ g_assert_cmpint(pixel_height, ==, 1234);
+
+ g_clear_object(&meta);
+}
+
static void test_bgo_792239(void)
{
GExiv2Metadata *meta = NULL;
@@ -134,6 +157,7 @@ int main(int argc, char *argv[static argc + 1])
g_test_add_func("/bugs/gnome/792239", test_bgo_792239);
g_test_add_func("/bugs/gnome/790925", test_bgo_790925);
g_test_add_func("/bugs/gnome/gitlab/31", test_ggo_31);
+ g_test_add_func("/bugs/gnome/gitlab/32", test_ggo_32);
return g_test_run();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]