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 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>(); }
public virtual void TestYResolutionDescription() { ExifIFD0Directory directory = new ExifIFD0Directory(); directory.SetRational(ExifIFD0Directory.TagYResolution, new Rational(50, 1)); // 3 is for 'cm' directory.SetInt(ExifIFD0Directory.TagResolutionUnit, 3); ExifIFD0Descriptor descriptor = new ExifIFD0Descriptor(directory); Sharpen.Tests.AreEqual("50 dots per cm", descriptor.GetDescription(ExifIFD0Directory.TagYResolution)); }
public virtual void TestXResolutionDescription() { ExifIFD0Directory directory = new ExifIFD0Directory(); directory.SetRational(ExifIFD0Directory.TagXResolution, new Rational(72, 1)); // 2 is for 'Inch' directory.SetInt(ExifIFD0Directory.TagResolutionUnit, 2); ExifIFD0Descriptor descriptor = new ExifIFD0Descriptor(directory); Sharpen.Tests.AreEqual("72 dots per inch", descriptor.GetDescription(ExifIFD0Directory.TagXResolution)); }
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 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 TestResolution() { Com.Drew.Metadata.Metadata metadata = ExifReaderTest.ProcessBytes("Tests/Data/withUncompressedRGBThumbnail.jpg.app1"); ExifThumbnailDirectory thumbnailDirectory = metadata.GetDirectory <ExifThumbnailDirectory>(); NUnit.Framework.Assert.IsNotNull(thumbnailDirectory); Sharpen.Tests.AreEqual(72, thumbnailDirectory.GetInt(ExifThumbnailDirectory.TagXResolution)); ExifIFD0Directory exifIFD0Directory = metadata.GetDirectory <ExifIFD0Directory>(); NUnit.Framework.Assert.IsNotNull(exifIFD0Directory); Sharpen.Tests.AreEqual(216, exifIFD0Directory.GetInt(ExifIFD0Directory.TagXResolution)); }
public virtual void ExtractTiff(RandomAccessReader reader, Com.Drew.Metadata.Metadata metadata) { ExifIFD0Directory directory = metadata.GetOrCreateDirectory <ExifIFD0Directory>(); try { ExtractTiff(reader, metadata, directory, 0); } catch (IOException e) { directory.AddError("IO problem: " + e.Message); } }
public virtual void TestDifferenceImageAndThumbnailOrientations() { // This metadata contains different orientations for the thumbnail and the main image. // These values used to be merged into a single directory, causing errors. // This unit test demonstrates correct behaviour. Com.Drew.Metadata.Metadata metadata = ProcessBytes("Tests/Data/repeatedOrientationTagWithDifferentValues.jpg.app1"); ExifIFD0Directory ifd0Directory = metadata.GetFirstDirectoryOfType <ExifIFD0Directory>(); ExifThumbnailDirectory thumbnailDirectory = metadata.GetFirstDirectoryOfType <ExifThumbnailDirectory>(); NUnit.Framework.Assert.IsNotNull(ifd0Directory); NUnit.Framework.Assert.IsNotNull(thumbnailDirectory); Sharpen.Tests.AreEqual(1, ifd0Directory.GetInt(ExifIFD0Directory.TagOrientation)); Sharpen.Tests.AreEqual(8, thumbnailDirectory.GetInt(ExifThumbnailDirectory.TagOrientation)); }
public virtual void TestWindowsXpFields() { ExifIFD0Directory directory = ExifReaderTest.ProcessBytes <ExifIFD0Directory>("Tests/Data/windowsXpFields.jpg.app1"); Sharpen.Tests.AreEqual("Testing artist\x0", directory.GetString(ExifIFD0Directory.TagWinAuthor, "UTF-16LE")); Sharpen.Tests.AreEqual("Testing comments\x0", directory.GetString(ExifIFD0Directory.TagWinComment, "UTF-16LE")); Sharpen.Tests.AreEqual("Testing keywords\x0", directory.GetString(ExifIFD0Directory.TagWinKeywords, "UTF-16LE")); Sharpen.Tests.AreEqual("Testing subject\x0", directory.GetString(ExifIFD0Directory.TagWinSubject, "UTF-16LE")); Sharpen.Tests.AreEqual("Testing title\x0", directory.GetString(ExifIFD0Directory.TagWinTitle, "UTF-16LE")); ExifIFD0Descriptor descriptor = new ExifIFD0Descriptor(directory); Sharpen.Tests.AreEqual("Testing artist", descriptor.GetDescription(ExifIFD0Directory.TagWinAuthor)); Sharpen.Tests.AreEqual("Testing comments", descriptor.GetDescription(ExifIFD0Directory.TagWinComment)); Sharpen.Tests.AreEqual("Testing keywords", descriptor.GetDescription(ExifIFD0Directory.TagWinKeywords)); Sharpen.Tests.AreEqual("Testing subject", descriptor.GetDescription(ExifIFD0Directory.TagWinSubject)); Sharpen.Tests.AreEqual("Testing title", descriptor.GetDescription(ExifIFD0Directory.TagWinTitle)); }
public virtual void TestToString() { Com.Drew.Metadata.Directory directory = new ExifIFD0Directory(); Sharpen.Tests.AreEqual("Exif IFD0 Directory (0 tags)", Sharpen.Extensions.ConvertToString(directory)); directory.SetString(1, "Tag 1"); Sharpen.Tests.AreEqual("Exif IFD0 Directory (1 tag)", Sharpen.Extensions.ConvertToString(directory)); directory.SetString(2, "Tag 2"); Sharpen.Tests.AreEqual("Exif IFD0 Directory (2 tags)", Sharpen.Extensions.ConvertToString(directory)); }
public virtual void TestDateTime() { ExifIFD0Directory directory = ExifReaderTest.ProcessBytes <ExifIFD0Directory>("Tests/Data/manuallyAddedThumbnail.jpg.app1"); Sharpen.Tests.AreEqual("2002:11:27 18:00:35", directory.GetString(ExifIFD0Directory.TagDatetime)); }