/*
        [Interoperability] Interoperability Index = Recommended Exif Interoperability Rules (ExifR98)
        [Interoperability] Interoperability Version = 1.00
        [Jpeg] Data Precision = 8 bits
        [Jpeg] Image Width = 600 pixels
        [Jpeg] Image Height = 800 pixels
        [Jpeg] Number of Components = 3
        [Jpeg] Component 1 = Y component: Quantization table 0, Sampling factors 1 horiz/1 vert
        [Jpeg] Component 2 = Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert
        [Jpeg] Component 3 = Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert
    */

        public NikonType1MakernoteTest()
        {
            var metadata = ExifReaderTest.ProcessSegmentBytes("Tests/Data/nikonMakernoteType1.jpg.app1").ToList();

            _nikonDirectory = metadata.OfType<NikonType1MakernoteDirectory>().SingleOrDefault();
            _exifSubIfdDirectory = metadata.OfType<ExifSubIfdDirectory>().SingleOrDefault();
            _exifIfd0Directory = metadata.OfType<ExifIfd0Directory>().SingleOrDefault();
            _thumbDirectory = metadata.OfType<ExifThumbnailDirectory>().SingleOrDefault();
        }
 public void TestUserCommentDescription_BlankAscii()
 {
     var commentBytes = Encoding.UTF8.GetBytes("ASCII\x0\x0\x0          ");
     var directory = new ExifSubIfdDirectory();
     directory.Set(ExifDirectoryBase.TagUserComment, commentBytes);
     var descriptor = new ExifSubIfdDescriptor(directory);
     Assert.Equal(string.Empty, descriptor.GetDescription(ExifDirectoryBase.TagUserComment));
 }
 public void TestUserCommentDescription_AsciiHeaderAsciiEncoding()
 {
     var commentBytes = Encoding.UTF8.GetBytes("ASCII\x0\x0This is a comment");
     var directory = new ExifSubIfdDirectory();
     directory.Set(ExifDirectoryBase.TagUserComment, commentBytes);
     var descriptor = new ExifSubIfdDescriptor(directory);
     Assert.Equal("This is a comment", descriptor.GetDescription(ExifDirectoryBase.TagUserComment));
 }
 public void TestUnicodeComment_Ascii()
 {
     var commentBytes = new byte[] { 65, 83, 67, 73, 73, 0, 0, 0, 73, 32, 97, 109, 32, 97, 32, 99, 111, 109, 109, 101, 110, 116, 46, 32, 89, 101, 121, 46, 0 };
     var directory = new ExifSubIfdDirectory();
     directory.Set(ExifDirectoryBase.TagUserComment, commentBytes);
     var descriptor = new ExifSubIfdDescriptor(directory);
     Assert.Equal("I am a comment. Yey.", descriptor.GetDescription(ExifDirectoryBase.TagUserComment));
 }
 public void TestUserCommentDescription_ZeroLengthAscii2()
 {
     // fill the 10-byte encoding region
     var commentBytes = Encoding.UTF8.GetBytes("ASCII\x0\x0\x0\x0\x0");
     var directory = new ExifSubIfdDirectory();
     directory.Set(ExifDirectoryBase.TagUserComment, commentBytes);
     var descriptor = new ExifSubIfdDescriptor(directory);
     Assert.Equal(string.Empty, descriptor.GetDescription(ExifDirectoryBase.TagUserComment));
 }
 public void TestUserCommentDescription_ZeroLengthAscii1()
 {
     // the 10-byte encoding region is only partially full
     var commentBytes = Encoding.UTF8.GetBytes("ASCII\x0\x0\x0");
     var directory = new ExifSubIfdDirectory();
     directory.Set(ExifDirectoryBase.TagUserComment, commentBytes);
     var descriptor = new ExifSubIfdDescriptor(directory);
     Assert.Equal("ASCII", descriptor.GetDescription(ExifDirectoryBase.TagUserComment));
 }
 public void TestGetDirectoryName()
 {
     Directory subIfdDirectory = new ExifSubIfdDirectory();
     Directory ifd0Directory = new ExifIfd0Directory();
     Directory thumbDirectory = new ExifThumbnailDirectory();
     Assert.False(subIfdDirectory.HasError);
     Assert.False(ifd0Directory.HasError);
     Assert.False(thumbDirectory.HasError);
     Assert.Equal("Exif IFD0", ifd0Directory.Name);
     Assert.Equal("Exif SubIFD", subIfdDirectory.Name);
     Assert.Equal("Exif Thumbnail", thumbDirectory.Name);
 }
 public void TestUnicodeComment_ActualBytes()
 {
     var commentBytes = new byte[] { 85, 78, 73, 67, 79, 68, 69, 0, 84, 0, 104, 0, 105, 0, 115, 0, 32, 0, 109, 0, 97, 0, 114, 0, 109, 0, 111, 0, 116, 0, 32, 0, 105, 0, 115, 0, 32, 0, 103, 0, 101, 0, 116, 0, 116, 0, 105, 0, 110, 0, 103, 0, 32
         , 0, 99, 0, 108, 0, 111, 0, 115, 0, 101, 0, 46, 0, 46, 0, 46, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0,
         32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32
         , 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32,
         0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0, 32, 0 };
     var directory = new ExifSubIfdDirectory();
     directory.Set(ExifDirectoryBase.TagUserComment, commentBytes);
     var descriptor = new ExifSubIfdDescriptor(directory);
     Assert.Equal("This marmot is getting close...", descriptor.GetDescription(ExifDirectoryBase.TagUserComment));
 }