Ejemplo n.º 1
0
        public void ValidateWithBrokenSidecar()
        {
            // Tests the file with a sidecar
            var uri         = ImageTestHelper.CreateTempFile("taglib-sample.jpg");
            var sidecar_uri = ImageTestHelper.CopySidecarToTest(uri, "taglib-sample-broken.xmp");

            var file = Metadata.Parse(uri);

            Assert.IsNotNull(file);

            var xmp = file.GetTag(TagTypes.XMP) as XmpTag;

            // Xmp.MicrosoftPhoto_1_.DateAcquired (XmpText/20) "2009-08-04T20:42:36Z"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.MS_PHOTO_NS, "DateAcquired");
                Assert.AreEqual("2009-08-04T20:42:36Z", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }

            Assert.AreEqual(new[] { "Kirche Sulzbach" }, file.ImageTag.Keywords);

            ImageTestHelper.DeleteTempFile(uri);
            ImageTestHelper.DeleteTempFile(sidecar_uri);
        }
Ejemplo n.º 2
0
        public void ValidateWithBrokenMetadata()
        {
            // Tests the file with a sidecar
            var uri         = ImageTestHelper.CreateTempFile("taglib-sample-broken.jpg");
            var sidecar_uri = ImageTestHelper.CopySidecarToTest(uri, "taglib-sample-broken.xmp");

            var file = Metadata.Parse(uri);

            Assert.IsNull(file);

            ImageTestHelper.DeleteTempFile(uri);
            ImageTestHelper.DeleteTempFile(sidecar_uri);
        }
Ejemplo n.º 3
0
        public void ValidateWithBrokenSidecar()
        {
            // Tests the file with a sidecar
            var uri = ImageTestHelper.CreateTempFile("taglib-sample.jpg");
            var res = new TagLibFileAbstraction()
            {
                Uri = uri
            };
            var sidecar_uri = ImageTestHelper.CopySidecarToTest(uri, "taglib-sample-broken.xmp");
            var sidecar_res = new TagLibFileAbstraction()
            {
                Uri = sidecar_uri
            };

            var file = File.Create(res) as TagLib.Image.File;

            Assert.IsNotNull(file);

            // Override by sidecar file should fail
            bool success = file.ParseXmpSidecar(sidecar_res);

            Assert.IsFalse(success);

            var xmp = file.GetTag(TagTypes.XMP) as XmpTag;

            // Xmp.MicrosoftPhoto_1_.DateAcquired (XmpText/20) "2009-08-04T20:42:36Z"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.MS_PHOTO_NS, "DateAcquired");
                Assert.AreEqual("2009-08-04T20:42:36Z", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }

            Assert.AreEqual(new string [] { "Kirche Sulzbach" }, file.ImageTag.Keywords);

            ImageTestHelper.DeleteTempFile(uri);
            ImageTestHelper.DeleteTempFile(sidecar_uri);
        }
Ejemplo n.º 4
0
        public void ValidateWithSidecar()
        {
            // Tests the file with a sidecar
            var uri = ImageTestHelper.CreateTempFile("taglib-sample.jpg");
            var res = new TagLibFileAbstraction()
            {
                Uri = uri
            };
            var sidecar_uri = ImageTestHelper.CopySidecarToTest(uri, "taglib-sample.xmp");
            var sidecar_res = new TagLibFileAbstraction()
            {
                Uri = sidecar_uri
            };

            var file = File.Create(res) as TagLib.Image.File;

            Assert.IsNotNull(file);

            // Override by sidecar file
            bool success = file.ParseXmpSidecar(sidecar_res);

            Assert.IsTrue(success);

            var xmp = file.GetTag(TagTypes.XMP) as XmpTag;

            // Xmp.MicrosoftPhoto_1_.DateAcquired (XmpText/20) "2009-08-04T20:42:36Z"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.MS_PHOTO_NS, "DateAcquired");
                Assert.IsNull(node);
            }

            Assert.AreEqual(new string [] { "F-Spot", "metadata", "test" }, file.ImageTag.Keywords);

            ImageTestHelper.DeleteTempFile(uri);
            ImageTestHelper.DeleteTempFile(sidecar_uri);
        }
Ejemplo n.º 5
0
        public void ValidateWithSidecar()
        {
            // Tests the file with a sidecar
            var uri         = ImageTestHelper.CreateTempFile("taglib-sample.jpg");
            var sidecar_uri = ImageTestHelper.CopySidecarToTest(uri, "taglib-sample.xmp");

            var file = Metadata.Parse(uri);

            Assert.IsNotNull(file);

            var xmp = file.GetTag(TagTypes.XMP) as XmpTag;

            // Xmp.MicrosoftPhoto_1_.DateAcquired (XmpText/20) "2009-08-04T20:42:36Z"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.MS_PHOTO_NS, "DateAcquired");
                Assert.IsNull(node);
            }

            Assert.AreEqual(new[] { "F-Spot", "metadata", "test" }, file.ImageTag.Keywords);

            ImageTestHelper.DeleteTempFile(uri);
            ImageTestHelper.DeleteTempFile(sidecar_uri);
        }