From 04f8b1cc9a2989f0d852d5bae11d47487dfcab43 Mon Sep 17 00:00:00 2001 From: swackhamer Date: Sat, 1 Aug 2026 22:53:28 -0500 Subject: [PATCH] test(makernotes): delete three suites that mirror fabricated tag tables These three files were never declared to Cargo, so they had never compiled. Compiling them was not the fix: every tag name they assert appears in **zero** ExifTool 13.59 source files. Declaring them would pin invented data as expected behaviour -- the exact mechanism that let the fabricated `registries/apple.rs` survive. Verified against ExifTool 13.59 (/tmp/oxidex-exiftool-cache/exiftool), using `grep -a -r "Name => ''"` over lib/, i.e. ExifTool's own tag tables. qualcomm_makernotes_tests.rs (17 tests) Tests `QualcommParser`, which production already deleted as a fabrication (see the note in makernotes::mod). Asserted ClearSight, ClearSightMode, ChromaFlash, OptiZoom, BokehMode, BokehLevel, ZoomLevel, HDRMode, NightMode, LowLightMode, SceneDetection, PhaseDetectAF, FrameMergeCount, MultiFrameNoiseReduction under "Qualcomm:" -- all absent from Qualcomm.pm. The file outlived the parser's deletion only because nothing compiled it. google_makernotes_tests.rs (17 tests) Asserted Astrophotography, ColorPop, FaceRetouching, HDRPlusMode, MergedFrameCount, NightSight, SceneDetection, SuperResZoom -- 0 hits each. ExifTool's *only* Google MakerNote table is Google::HDRPlusMakerNote, and it is string-id keyed protobuf (ID_FMT => 'str', ids like '1-1', '9-36-1', base64 + encrypted + gzipped), not a numeric TIFF IFD. Its real tags are ImageName, ImageData, TimeLogText, SummaryText, FrameCount, CreateDate. microsoft_makernotes_tests.rs (16 tests) Asserted AutoHDR, CreativeEffect, DynamicFlash, LensType, OpticalStabilization, PanoramaMode, PureViewMode, Refocus, RichCapture, RichCaptureMode, RichRecordingAudio, Video4K. Only LensType (10 other vendors' modules) and PanoramaMode (Kodak, Olympus) exist at all, and neither in Microsoft.pm. MakerNotes.pm has no MakerNoteMicrosoft dispatch; Microsoft.pm's only MakerNotes-group table is Microsoft::Stitch, binary data in EXIF tag 0x4748 with tags PanoramicStitchVersion / ...CameraMotion / ...MapType. google and microsoft were *passing*. That is the finding, not a reassurance: they pass because `makernotes/google.rs` and `makernotes/microsoft.rs` invent exactly the names the tests assert. A test that mirrors a fabricated table cannot detect the fabrication, and leaving it in place would make removing the invented production tags look like a regression. The production fabrication itself is NOT fixed here -- it is a behavioural change across three vendor parsers and needs its own review. It is reported separately. 50 tests deleted, 0 kept. No production code changed. 554 integration tests pass under --all-features. Co-Authored-By: Claude Opus 5 --- tests/integration.rs | 6 + tests/integration/google_makernotes_tests.rs | 329 ------------------ .../integration/microsoft_makernotes_tests.rs | 184 ---------- .../integration/qualcomm_makernotes_tests.rs | 195 ----------- 4 files changed, 6 insertions(+), 708 deletions(-) delete mode 100644 tests/integration/google_makernotes_tests.rs delete mode 100644 tests/integration/microsoft_makernotes_tests.rs delete mode 100644 tests/integration/qualcomm_makernotes_tests.rs diff --git a/tests/integration.rs b/tests/integration.rs index c6485c03a..76ed7d51a 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -162,5 +162,11 @@ mod opus_integration_tests; #[path = "integration/ape_integration_tests.rs"] mod ape_integration_tests; +// No qualcomm/google/microsoft MakerNote test modules: those three suites were +// deleted rather than declared. Every tag name they asserted appears in zero +// ExifTool 13.59 source files, so declaring them would have pinned invented +// data as expected behaviour. See the commit that removed them for the +// name-by-name evidence. + #[path = "forensic/mod.rs"] mod forensic; diff --git a/tests/integration/google_makernotes_tests.rs b/tests/integration/google_makernotes_tests.rs deleted file mode 100644 index d17a0595b..000000000 --- a/tests/integration/google_makernotes_tests.rs +++ /dev/null @@ -1,329 +0,0 @@ -//! Integration tests for Google (Pixel) MakerNotes parser -//! -//! Tests the Google Pixel MakerNotes parsing functionality including: -//! - MakerNoteParser trait implementation -//! - Header validation -//! - HDR+ mode detection -//! - Night Sight status -//! - Super Res Zoom -//! - Motion Photos -//! - Computational photography settings - -use oxidex::parsers::tiff::ifd_parser::ByteOrder; -use oxidex::parsers::tiff::makernotes::google::GoogleParser; -use oxidex::parsers::tiff::makernotes::shared::MakerNoteParser; -use std::collections::HashMap; - -#[test] -fn test_google_parser_trait() { - let parser = GoogleParser::new(); - assert_eq!(parser.manufacturer_name(), "Google"); - assert_eq!(parser.tag_prefix(), "Google:"); -} - -#[test] -fn test_google_validate_header_with_signature() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - data.extend_from_slice(b"Google"); - data.extend_from_slice(&[0x00, 0x00]); // Padding - data.extend_from_slice(&[0x05, 0x00]); // 5 entries - - assert!(parser.validate_header(&data)); -} - -#[test] -fn test_google_hdr_plus_off() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x01, 0x00]); // Tag: HDR+ Mode - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x00, 0x00, 0x00, 0x00]); // Value: 0 (Off) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:HDRPlusMode"), Some(&"Off".to_string())); -} - -#[test] -fn test_google_hdr_plus_enhanced() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x01, 0x00]); // Tag - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x02, 0x00, 0x00, 0x00]); // Value: 2 (Enhanced) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!( - tags.get("Google:HDRPlusMode"), - Some(&"HDR+ Enhanced".to_string()) - ); -} - -#[test] -fn test_google_night_sight_off() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x03, 0x00]); // Tag: Night Sight - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x00, 0x00, 0x00, 0x00]); // Value: 0 (Off) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:NightSight"), Some(&"Off".to_string())); -} - -#[test] -fn test_google_night_sight_on() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x03, 0x00]); // Tag - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x02, 0x00, 0x00, 0x00]); // Value: 2 (On) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:NightSight"), Some(&"On".to_string())); -} - -#[test] -fn test_google_night_sight_astrophotography() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x03, 0x00]); // Tag - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x03, 0x00, 0x00, 0x00]); // Value: 3 (Astrophotography) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!( - tags.get("Google:NightSight"), - Some(&"Astrophotography".to_string()) - ); -} - -#[test] -fn test_google_super_res_zoom_off() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x05, 0x00]); // Tag: Super Res Zoom - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x00, 0x00, 0x00, 0x00]); // Value: 0 (Off) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:SuperResZoom"), Some(&"Off".to_string())); -} - -#[test] -fn test_google_super_res_zoom_2x() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x05, 0x00]); // Tag - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x14, 0x00, 0x00, 0x00]); // Value: 20 (2.0x) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:SuperResZoom"), Some(&"2.0x".to_string())); -} - -#[test] -fn test_google_super_res_zoom_7_5x() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x05, 0x00]); // Tag - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x4B, 0x00, 0x00, 0x00]); // Value: 75 (7.5x) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:SuperResZoom"), Some(&"7.5x".to_string())); -} - -#[test] -fn test_google_scene_detection_food() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x0B, 0x00]); // Tag: Scene Detection - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x07, 0x00, 0x00, 0x00]); // Value: 7 (Food) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:SceneDetection"), Some(&"Food".to_string())); -} - -#[test] -fn test_google_face_retouching() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x09, 0x00]); // Tag: Face Retouching - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x32, 0x00, 0x00, 0x00]); // Value: 50 - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:FaceRetouching"), Some(&"50".to_string())); -} - -#[test] -fn test_google_color_pop_on() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x0F, 0x00]); // Tag: Color Pop - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Value: 1 (On) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.get("Google:ColorPop"), Some(&"On".to_string())); -} - -#[test] -fn test_google_astrophotography_on() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x11, 0x00]); // Tag: Astrophotography - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Value: 1 (On) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!( - tags.get("Google:Astrophotography"), - Some(&"On".to_string()) - ); -} - -#[test] -fn test_google_frame_merge_count() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - data.extend_from_slice(&[0x01, 0x00]); // 1 entry - data.extend_from_slice(&[0x19, 0x00]); // Tag: Frame Count - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x0F, 0x00, 0x00, 0x00]); // Value: 15 frames - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!( - tags.get("Google:MergedFrameCount"), - Some(&"15".to_string()) - ); -} - -#[test] -fn test_google_multiple_tags() { - let parser = GoogleParser::new(); - let mut data = Vec::new(); - - // Create IFD with multiple entries - data.extend_from_slice(&[0x03, 0x00]); // 3 entries - - // HDR+ Mode - data.extend_from_slice(&[0x01, 0x00]); // Tag - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x02, 0x00, 0x00, 0x00]); // Value: 2 (Enhanced) - - // Night Sight - data.extend_from_slice(&[0x03, 0x00]); // Tag - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x02, 0x00, 0x00, 0x00]); // Value: 2 (On) - - // Super Res Zoom - data.extend_from_slice(&[0x05, 0x00]); // Tag - data.extend_from_slice(&[0x03, 0x00]); // Type: SHORT - data.extend_from_slice(&[0x01, 0x00, 0x00, 0x00]); // Count: 1 - data.extend_from_slice(&[0x20, 0x00, 0x00, 0x00]); // Value: 32 (3.2x) - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_ok()); - assert_eq!(tags.len(), 3); - assert_eq!( - tags.get("Google:HDRPlusMode"), - Some(&"HDR+ Enhanced".to_string()) - ); - assert_eq!(tags.get("Google:NightSight"), Some(&"On".to_string())); - assert_eq!(tags.get("Google:SuperResZoom"), Some(&"3.2x".to_string())); -} - -#[test] -fn test_google_invalid_data() { - let parser = GoogleParser::new(); - let data = vec![0x01]; // Too short - - let mut tags = HashMap::new(); - let result = parser.parse(&data, ByteOrder::LittleEndian, &mut tags); - - assert!(result.is_err()); -} diff --git a/tests/integration/microsoft_makernotes_tests.rs b/tests/integration/microsoft_makernotes_tests.rs deleted file mode 100644 index a11599931..000000000 --- a/tests/integration/microsoft_makernotes_tests.rs +++ /dev/null @@ -1,184 +0,0 @@ -//! Integration tests for Microsoft (Lumia) MakerNotes parser - -use oxidex::parsers::tiff::ifd_parser::ByteOrder; -use oxidex::parsers::tiff::makernotes::microsoft::MicrosoftParser; -use oxidex::parsers::tiff::makernotes::shared::MakerNoteParser; -use std::collections::HashMap; - -#[test] -fn test_microsoft_parser_trait() { - let parser = MicrosoftParser::new(); - assert_eq!(parser.manufacturer_name(), "Microsoft"); - assert_eq!(parser.tag_prefix(), "Microsoft:"); -} - -#[test] -fn test_microsoft_rich_capture_on() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:RichCapture"), Some(&"On".to_string())); -} - -#[test] -fn test_microsoft_rich_capture_mode_hdr() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:RichCaptureMode"), Some(&"HDR".to_string())); -} - -#[test] -fn test_microsoft_rich_capture_mode_hdr_flash() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:RichCaptureMode"), Some(&"HDR + Flash".to_string())); -} - -#[test] -fn test_microsoft_dynamic_flash() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x06, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:DynamicFlash"), Some(&"Flash + No Flash Blend".to_string())); -} - -#[test] -fn test_microsoft_refocus_available() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x08, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:Refocus"), Some(&"Available".to_string())); -} - -#[test] -fn test_microsoft_pureview_mode_5mp() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x0B, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:PureViewMode"), Some(&"5MP Oversampled".to_string())); -} - -#[test] -fn test_microsoft_pureview_mode_lossless_zoom() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x0B, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:PureViewMode"), Some(&"Lossless Zoom".to_string())); -} - -#[test] -fn test_microsoft_creative_effect_vintage() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x0E, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:CreativeEffect"), Some(&"Vintage".to_string())); -} - -#[test] -fn test_microsoft_video_4k_on() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x10, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:Video4K"), Some(&"On".to_string())); -} - -#[test] -fn test_microsoft_rich_recording_on() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x12, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:RichRecordingAudio"), Some(&"On".to_string())); -} - -#[test] -fn test_microsoft_ois_on() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x14, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:OpticalStabilization"), Some(&"On (OIS)".to_string())); -} - -#[test] -fn test_microsoft_auto_hdr_on() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x16, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:AutoHDR"), Some(&"On".to_string())); -} - -#[test] -fn test_microsoft_panorama_on() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x18, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:PanoramaMode"), Some(&"On".to_string())); -} - -#[test] -fn test_microsoft_lens_type_wide_angle() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x1A, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Microsoft:LensType"), Some(&"Wide Angle Attachment".to_string())); -} - -#[test] -fn test_microsoft_multiple_tags() { - let parser = MicrosoftParser::new(); - let mut data = vec![0x02, 0x00]; // 2 entries - - // Rich Capture - data.extend_from_slice(&[0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - // PureView Mode - data.extend_from_slice(&[0x0B, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.len(), 2); - assert_eq!(tags.get("Microsoft:RichCapture"), Some(&"On".to_string())); - assert_eq!(tags.get("Microsoft:PureViewMode"), Some(&"5MP Oversampled".to_string())); -} diff --git a/tests/integration/qualcomm_makernotes_tests.rs b/tests/integration/qualcomm_makernotes_tests.rs deleted file mode 100644 index d8bc1d7c2..000000000 --- a/tests/integration/qualcomm_makernotes_tests.rs +++ /dev/null @@ -1,195 +0,0 @@ -//! Integration tests for Qualcomm MakerNotes parser - -use oxidex::parsers::tiff::ifd_parser::ByteOrder; -use oxidex::parsers::tiff::makernotes::qualcomm::QualcommParser; -use oxidex::parsers::tiff::makernotes::shared::MakerNoteParser; -use std::collections::HashMap; - -#[test] -fn test_qualcomm_parser_trait() { - let parser = QualcommParser::new(); - assert_eq!(parser.manufacturer_name(), "Qualcomm"); - assert_eq!(parser.tag_prefix(), "Qualcomm:"); -} - -#[test] -fn test_qualcomm_clear_sight_on() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:ClearSight"), Some(&"On".to_string())); -} - -#[test] -fn test_qualcomm_clear_sight_mode_fusion() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x02, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:ClearSightMode"), Some(&"Monochrome + RGB Fusion".to_string())); -} - -#[test] -fn test_qualcomm_chroma_flash() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x04, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:ChromaFlash"), Some(&"Flash + No Flash Blend".to_string())); -} - -#[test] -fn test_qualcomm_optizoom_medium() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x07, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:OptiZoom"), Some(&"Medium".to_string())); -} - -#[test] -fn test_qualcomm_zoom_level_5x() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x08, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:ZoomLevel"), Some(&"5.0x".to_string())); -} - -#[test] -fn test_qualcomm_hdr_mode() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x0A, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:HDRMode"), Some(&"HDR".to_string())); -} - -#[test] -fn test_qualcomm_hdr_mode_staggered() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x0A, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:HDRMode"), Some(&"Staggered HDR".to_string())); -} - -#[test] -fn test_qualcomm_scene_detection_portrait() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x0E, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:SceneDetection"), Some(&"Portrait".to_string())); -} - -#[test] -fn test_qualcomm_bokeh_mode_on() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x10, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:BokehMode"), Some(&"On".to_string())); -} - -#[test] -fn test_qualcomm_bokeh_level() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x11, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:BokehLevel"), Some(&"75".to_string())); -} - -#[test] -fn test_qualcomm_low_light_mode_on() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x13, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:LowLightMode"), Some(&"On".to_string())); -} - -#[test] -fn test_qualcomm_night_mode_on() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x15, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:NightMode"), Some(&"On".to_string())); -} - -#[test] -fn test_qualcomm_phase_detect_af() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x17, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:PhaseDetectAF"), Some(&"Active".to_string())); -} - -#[test] -fn test_qualcomm_frame_merge_count() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x1B, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:FrameMergeCount"), Some(&"10".to_string())); -} - -#[test] -fn test_qualcomm_multi_frame_nr_on() { - let parser = QualcommParser::new(); - let mut data = vec![0x01, 0x00]; - data.extend_from_slice(&[0x0C, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.get("Qualcomm:MultiFrameNoiseReduction"), Some(&"On".to_string())); -} - -#[test] -fn test_qualcomm_multiple_tags() { - let parser = QualcommParser::new(); - let mut data = vec![0x02, 0x00]; // 2 entries - - // Clear Sight - data.extend_from_slice(&[0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - // HDR Mode - data.extend_from_slice(&[0x0A, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00]); - - let mut tags = HashMap::new(); - assert!(parser.parse(&data, ByteOrder::LittleEndian, &mut tags).is_ok()); - assert_eq!(tags.len(), 2); - assert_eq!(tags.get("Qualcomm:ClearSight"), Some(&"On".to_string())); - assert_eq!(tags.get("Qualcomm:HDRMode"), Some(&"HDR".to_string())); -}