public virtual void TestSonyType1Makernote() { SonyType1MakernoteDirectory directory = ExifReaderTest.ProcessBytes <SonyType1MakernoteDirectory>("Tests/Data/sonyType1.jpg.app1"); NUnit.Framework.Assert.IsNotNull(directory); Sharpen.Tests.IsFalse(directory.HasErrors()); SonyType1MakernoteDescriptor descriptor = new SonyType1MakernoteDescriptor(directory); NUnit.Framework.Assert.IsNull(directory.GetObject(SonyType1MakernoteDirectory.TagColorTemperature)); NUnit.Framework.Assert.IsNull(descriptor.GetColorTemperatureDescription()); NUnit.Framework.Assert.IsNull(directory.GetObject(SonyType1MakernoteDirectory.TagSceneMode)); NUnit.Framework.Assert.IsNull(descriptor.GetSceneModeDescription()); NUnit.Framework.Assert.IsNull(directory.GetObject(SonyType1MakernoteDirectory.TagZoneMatching)); NUnit.Framework.Assert.IsNull(descriptor.GetZoneMatchingDescription()); NUnit.Framework.Assert.IsNull(directory.GetObject(SonyType1MakernoteDirectory.TagDynamicRangeOptimiser)); NUnit.Framework.Assert.IsNull(descriptor.GetDynamicRangeOptimizerDescription()); NUnit.Framework.Assert.IsNull(directory.GetObject(SonyType1MakernoteDirectory.TagImageStabilisation)); NUnit.Framework.Assert.IsNull(descriptor.GetImageStabilizationDescription()); NUnit.Framework.Assert.IsNull(directory.GetObject(SonyType1MakernoteDirectory.TagColorMode)); NUnit.Framework.Assert.IsNull(descriptor.GetColorModeDescription()); Sharpen.Tests.AreEqual("On (Shooting)", descriptor.GetAntiBlurDescription()); Sharpen.Tests.AreEqual("Program", descriptor.GetExposureModeDescription()); Sharpen.Tests.AreEqual("Off", descriptor.GetLongExposureNoiseReductionDescription()); Sharpen.Tests.AreEqual("Off", descriptor.GetMacroDescription()); Sharpen.Tests.AreEqual("Normal", descriptor.GetJpegQualityDescription()); }
public virtual void TestThumbnailCompression() { ExifThumbnailDirectory directory = ExifReaderTest.ProcessBytes <ExifThumbnailDirectory>("Tests/Data/manuallyAddedThumbnail.jpg.app1"); // 6 means JPEG compression Sharpen.Tests.AreEqual(6, directory.GetInt(ExifThumbnailDirectory.TagThumbnailCompression)); }
public virtual void SetUp() { System.Threading.Thread.CurrentThread.CurrentCulture = Sharpen.Extensions.CreateLocale("en", "GB"); _nikonDirectory = ExifReaderTest.ProcessBytes <NikonType2MakernoteDirectory>("Tests/Data/nikonMakernoteType2a.jpg.app1"); NUnit.Framework.Assert.IsNotNull(_nikonDirectory); _descriptor = new NikonType2MakernoteDescriptor(_nikonDirectory); }
public virtual void TestThumbnailData() { ExifThumbnailDirectory directory = ExifReaderTest.ProcessBytes <ExifThumbnailDirectory>("Tests/Data/manuallyAddedThumbnail.jpg.app1"); sbyte[] thumbnailData = directory.GetThumbnailData(); NUnit.Framework.Assert.IsNotNull(thumbnailData); Sharpen.Tests.AreEqual(2970, thumbnailData.Length); }
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 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 TestThumbnailYResolution() { ExifThumbnailDirectory directory = ExifReaderTest.ProcessBytes <ExifThumbnailDirectory>("Tests/Data/manuallyAddedThumbnail.jpg.app1"); Rational rational = directory.GetRational(ExifThumbnailDirectory.TagYResolution); NUnit.Framework.Assert.IsNotNull(rational); Sharpen.Tests.AreEqual(72, rational.GetNumerator()); Sharpen.Tests.AreEqual(1, rational.GetDenominator()); }
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); }
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 TestSonyType6Makernote() { SonyType6MakernoteDirectory directory = ExifReaderTest.ProcessBytes <SonyType6MakernoteDirectory>("Tests/Data/sonyType6.jpg.app1.0"); NUnit.Framework.Assert.IsNotNull(directory); Sharpen.Tests.IsFalse(directory.HasErrors()); SonyType6MakernoteDescriptor descriptor = new SonyType6MakernoteDescriptor(directory); Sharpen.Tests.AreEqual("2.00", descriptor.GetMakernoteThumbVersionDescription()); }
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 TestGetThumbnailData() { ExifThumbnailDirectory directory = ExifReaderTest.ProcessBytes <ExifThumbnailDirectory>("Tests/Data/withExif.jpg.app1"); sbyte[] thumbData = directory.GetThumbnailData(); NUnit.Framework.Assert.IsNotNull(thumbData); try { // attempt to read the thumbnail -- it should be a legal Jpeg file JpegSegmentReader.ReadSegments(new SequentialByteArrayReader(thumbData), null); } catch (JpegProcessingException) { NUnit.Framework.Assert.Fail("Unable to construct JpegSegmentReader from thumbnail data"); } }
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 TestWriteThumbnail() { ExifThumbnailDirectory directory = ExifReaderTest.ProcessBytes <ExifThumbnailDirectory>("Tests/Data/manuallyAddedThumbnail.jpg.app1"); Sharpen.Tests.IsTrue(directory.HasThumbnailData()); FilePath thumbnailFile = FilePath.CreateTempFile("thumbnail", ".jpg"); try { directory.WriteThumbnail(thumbnailFile.GetAbsolutePath()); FilePath file = new FilePath(thumbnailFile.GetAbsolutePath()); Sharpen.Tests.AreEqual(2970, file.Length()); Sharpen.Tests.IsTrue(file.Exists()); } finally { if (!thumbnailFile.Delete()) { NUnit.Framework.Assert.Fail("Unable to delete temp thumbnail file."); } } }
public virtual void SetUp() { _panasonicDirectory = ExifReaderTest.ProcessBytes <PanasonicMakernoteDirectory>("Tests/Data/withPanasonicFaces.jpg.app1"); }
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)); }
public virtual void SetUp() { _nikonDirectory = ExifReaderTest.ProcessBytes <NikonType2MakernoteDirectory>("Tests/Data/nikonMakernoteType2a.jpg.app1"); NUnit.Framework.Assert.IsNotNull(_nikonDirectory); _descriptor = new NikonType2MakernoteDescriptor(_nikonDirectory); }
public virtual void TestThumbnailLength() { ExifThumbnailDirectory directory = ExifReaderTest.ProcessBytes <ExifThumbnailDirectory>("Tests/Data/manuallyAddedThumbnail.jpg.app1"); Sharpen.Tests.AreEqual(2970, directory.GetInt(ExifThumbnailDirectory.TagThumbnailLength)); }