summaryrefslogtreecommitdiff
path: root/test/jfif/JfifSupport-Test.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-08-12 10:07:55 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-08-12 10:07:55 +0200
commit2333d2b06d52754a55a747fa438844286f98d53a (patch)
treee46351c8ec622c9d13232cf00c8a1048e55184af /test/jfif/JfifSupport-Test.vala
parent7f667adb7b8d3a803a6cd6120dcea4ba4ff89075 (diff)
parentd0aaad443a88968dc61172c050084d3d9faa7602 (diff)
Update upstream source from tag 'upstream/0.32.2'
Update to upstream version '0.32.2' with Debian dir f0c4eb48b3e5ba2a80bbd45ac2effe5ecd515530
Diffstat (limited to 'test/jfif/JfifSupport-Test.vala')
-rw-r--r--test/jfif/JfifSupport-Test.vala44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/jfif/JfifSupport-Test.vala b/test/jfif/JfifSupport-Test.vala
new file mode 100644
index 0000000..0fe94b5
--- /dev/null
+++ b/test/jfif/JfifSupport-Test.vala
@@ -0,0 +1,44 @@
+// SPDX-License-Identifier: LGPLv2.1-or-later
+
+[CCode (cname="TEST_DATA_DIR")]
+extern const string TEST_DATA_DIR;
+
+void add_jfif_sof_tests () {
+ Test.add_func ("/unit/photos/jfif/is_sof", () => {
+ Jpeg.Marker m = (Jpeg.Marker)0x8f;
+ assert(! m.is_sof());
+ m = (Jpeg.Marker)0xc0;
+ assert(m.is_sof());
+ m = (Jpeg.Marker)0xc4;
+ assert(! m.is_sof());
+ m = (Jpeg.Marker)0xe0;
+ assert(! m.is_sof());
+ });
+}
+
+void add_jfif_sniff_fast_tests () {
+ Test.add_func ("/functional/photos/jfif/sniff_fast", () => {
+ File f = File.new_for_path(TEST_DATA_DIR + "/shotwell-street.jpg");
+ JfifSniffer s = new JfifSniffer(f, PhotoFileSniffer.Options.NO_MD5);
+ bool is_corrupted = false;
+ try {
+ DetectedPhotoInformation detected = s.sniff(out is_corrupted);
+ assert(!is_corrupted);
+ assert(detected.channels == 3);
+ assert(detected.bits_per_channel == 8);
+ assert(detected.format_name == "jpeg");
+ assert(detected.image_dim.width == 360);
+ assert(detected.image_dim.height == 236);
+ } catch (Error err) {
+ assert_not_reached();
+ }
+ });
+}
+
+void main (string[] args) {
+ Test.init (ref args);
+ add_jfif_sof_tests();
+ add_jfif_sniff_fast_tests();
+ Test.run();
+}
+