public virtual void TestUserCommentDescription_AsciiHeaderAsciiEncoding()
		{
			sbyte[] commentBytes = Sharpen.Runtime.GetBytesForString("ASCII\x0\x0This is a comment");
			ExifSubIFDDirectory directory = new ExifSubIFDDirectory();
			directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
			ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);
			Sharpen.Tests.AreEqual("This is a comment", descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
		}
Ejemplo n.º 2
0
 public virtual void SetUp()
 {
     Com.Drew.Metadata.Metadata metadata = ExifReaderTest.ProcessBytes("Tests/Data/nikonMakernoteType1.jpg.app1");
     _nikonDirectory      = metadata.GetDirectory <NikonType1MakernoteDirectory>();
     _exifSubIFDDirectory = metadata.GetDirectory <ExifSubIFDDirectory>();
     _exifIFD0Directory   = metadata.GetDirectory <ExifIFD0Directory>();
     _thumbDirectory      = metadata.GetDirectory <ExifThumbnailDirectory>();
 }
Ejemplo n.º 3
0
        public virtual void TestLoadFujifilmJpeg()
        {
            ExifSubIFDDirectory directory = ExifReaderTest.ProcessBytes <ExifSubIFDDirectory>("Tests/Data/withExif.jpg.app1");
            string description            = directory.GetDescription(ExifSubIFDDirectory.TagIsoEquivalent);

            NUnit.Framework.Assert.IsNotNull(description);
            Sharpen.Tests.AreEqual("80", description);
        }
 public virtual void TestUnicodeComment_Ascii()
 {
     sbyte[] commentBytes = new sbyte[] { 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 };
     ExifSubIFDDirectory directory = new ExifSubIFDDirectory();
     directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
     ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);
     Sharpen.Tests.AreEqual("I am a comment. Yey.", descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
 }
 public virtual void SetUp()
 {
     Com.Drew.Metadata.Metadata metadata = ExifReaderTest.ProcessBytes("Tests/Data/nikonMakernoteType1.jpg.app1");
     _nikonDirectory = metadata.GetFirstDirectoryOfType<NikonType1MakernoteDirectory>();
     _exifSubIFDDirectory = metadata.GetFirstDirectoryOfType<ExifSubIFDDirectory>();
     _exifIFD0Directory = metadata.GetFirstDirectoryOfType<ExifIFD0Directory>();
     _thumbDirectory = metadata.GetFirstDirectoryOfType<ExifThumbnailDirectory>();
 }
		public virtual void TestUserCommentDescription_BlankAscii()
		{
			sbyte[] commentBytes = Sharpen.Runtime.GetBytesForString("ASCII\x0\x0\x0          ");
			ExifSubIFDDirectory directory = new ExifSubIFDDirectory();
			directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
			ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);
			Sharpen.Tests.AreEqual(string.Empty, descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
		}
Ejemplo n.º 7
0
        public virtual void TestCrashRegressionTest()
        {
            // This image was created via a resize in ACDSee.
            // It seems to have a reference to an IFD starting outside the data segment.
            // I've noticed that ACDSee reports a Comment for this image, yet ExifReader doesn't report one.
            ExifSubIFDDirectory directory = ExifReaderTest.ProcessBytes <ExifSubIFDDirectory>("Tests/Data/crash01.jpg.app1");

            Sharpen.Tests.IsTrue(directory.GetTagCount() > 0);
        }
Ejemplo n.º 8
0
 public virtual void TestHasErrors()
 {
     ExifSubIFDDirectory directory = new ExifSubIFDDirectory();
     directory.AddError("Test Error 1");
     Com.Drew.Metadata.Metadata metadata = new Com.Drew.Metadata.Metadata();
     Sharpen.Tests.IsFalse(metadata.HasErrors());
     metadata.AddDirectory(directory);
     Sharpen.Tests.IsTrue(metadata.HasErrors());
 }
		public virtual void TestUserCommentDescription_ZeroLengthAscii2()
		{
			// fill the 10-byte encoding region
			sbyte[] commentBytes = Sharpen.Runtime.GetBytesForString("ASCII\x0\x0\x0\x0\x0");
			ExifSubIFDDirectory directory = new ExifSubIFDDirectory();
			directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
			ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);
			Sharpen.Tests.AreEqual(string.Empty, descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
		}
        public virtual void TestUserCommentDescription_AsciiHeaderAsciiEncoding()
        {
            sbyte[]             commentBytes = Sharpen.Runtime.GetBytesForString("ASCII\x0\x0This is a comment");
            ExifSubIFDDirectory directory    = new ExifSubIFDDirectory();

            directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
            ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);

            Sharpen.Tests.AreEqual("This is a comment", descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
        }
        public virtual void TestUserCommentDescription_BlankAscii()
        {
            sbyte[]             commentBytes = Sharpen.Runtime.GetBytesForString("ASCII\x0\x0\x0          ");
            ExifSubIFDDirectory directory    = new ExifSubIFDDirectory();

            directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
            ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);

            Sharpen.Tests.AreEqual(string.Empty, descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
        }
        public virtual void TestUnicodeComment_Ascii()
        {
            sbyte[]             commentBytes = new sbyte[] { 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 };
            ExifSubIFDDirectory directory    = new ExifSubIFDDirectory();

            directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
            ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);

            Sharpen.Tests.AreEqual("I am a comment. Yey.", descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
        }
		public virtual void SetUp()
		{
			Com.Drew.Metadata.Metadata metadata = ExifReaderTest.ProcessBytes("Tests/Data/nikonMakernoteType2b.jpg.app1");
			_nikonDirectory = metadata.GetDirectory<NikonType2MakernoteDirectory>();
			_exifIFD0Directory = metadata.GetDirectory<ExifIFD0Directory>();
			_exifSubIFDDirectory = metadata.GetDirectory<ExifSubIFDDirectory>();
			_thumbDirectory = metadata.GetDirectory<ExifThumbnailDirectory>();
			NUnit.Framework.Assert.IsNotNull(_nikonDirectory);
			NUnit.Framework.Assert.IsNotNull(_exifSubIFDDirectory);
		}
 public virtual void SetUp()
 {
     Com.Drew.Metadata.Metadata metadata = ExifReaderTest.ProcessBytes("Tests/Data/nikonMakernoteType2b.jpg.app1");
     _nikonDirectory      = metadata.GetFirstDirectoryOfType <NikonType2MakernoteDirectory>();
     _exifIFD0Directory   = metadata.GetFirstDirectoryOfType <ExifIFD0Directory>();
     _exifSubIFDDirectory = metadata.GetFirstDirectoryOfType <ExifSubIFDDirectory>();
     _thumbDirectory      = metadata.GetFirstDirectoryOfType <ExifThumbnailDirectory>();
     NUnit.Framework.Assert.IsNotNull(_nikonDirectory);
     NUnit.Framework.Assert.IsNotNull(_exifSubIFDDirectory);
 }
        public virtual void TestUserCommentDescription_ZeroLengthAscii2()
        {
            // fill the 10-byte encoding region
            sbyte[]             commentBytes = Sharpen.Runtime.GetBytesForString("ASCII\x0\x0\x0\x0\x0");
            ExifSubIFDDirectory directory    = new ExifSubIFDDirectory();

            directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
            ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);

            Sharpen.Tests.AreEqual(string.Empty, descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
        }
 public virtual void TestUnicodeComment_ActualBytes()
 {
     sbyte[] commentBytes = new sbyte[] { 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 };
     ExifSubIFDDirectory directory = new ExifSubIFDDirectory();
     directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
     ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);
     Sharpen.Tests.AreEqual("This marmot is getting close...", descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
 }
Ejemplo n.º 17
0
 public virtual void TestGetDirectoryName()
 {
     Com.Drew.Metadata.Directory subIFDDirectory = new ExifSubIFDDirectory();
     Com.Drew.Metadata.Directory ifd0Directory   = new ExifIFD0Directory();
     Com.Drew.Metadata.Directory thumbDirectory  = new ExifThumbnailDirectory();
     Sharpen.Tests.IsFalse(subIFDDirectory.HasErrors());
     Sharpen.Tests.IsFalse(ifd0Directory.HasErrors());
     Sharpen.Tests.IsFalse(thumbDirectory.HasErrors());
     Sharpen.Tests.AreEqual("Exif IFD0", ifd0Directory.GetName());
     Sharpen.Tests.AreEqual("Exif SubIFD", subIFDDirectory.GetName());
     Sharpen.Tests.AreEqual("Exif Thumbnail", thumbDirectory.GetName());
 }
		public virtual void TestGetDirectoryName()
		{
			Com.Drew.Metadata.Directory subIFDDirectory = new ExifSubIFDDirectory();
			Com.Drew.Metadata.Directory ifd0Directory = new ExifIFD0Directory();
			Com.Drew.Metadata.Directory thumbDirectory = new ExifThumbnailDirectory();
			Sharpen.Tests.IsFalse(subIFDDirectory.HasErrors());
			Sharpen.Tests.IsFalse(ifd0Directory.HasErrors());
			Sharpen.Tests.IsFalse(thumbDirectory.HasErrors());
			Sharpen.Tests.AreEqual("Exif IFD0", ifd0Directory.GetName());
			Sharpen.Tests.AreEqual("Exif SubIFD", subIFDDirectory.GetName());
			Sharpen.Tests.AreEqual("Exif Thumbnail", thumbDirectory.GetName());
		}
Ejemplo n.º 19
0
        public virtual void TestUnicodeComment_ActualBytes()
        {
            sbyte[] commentBytes = new sbyte[] { 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 };
            ExifSubIFDDirectory directory = new ExifSubIFDDirectory();

            directory.SetByteArray(ExifSubIFDDirectory.TagUserComment, commentBytes);
            ExifSubIFDDescriptor descriptor = new ExifSubIFDDescriptor(directory);

            Sharpen.Tests.AreEqual("This marmot is getting close...", descriptor.GetDescription(ExifSubIFDDirectory.TagUserComment));
        }