Exemple #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);

            XmpTag 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);
        }
Exemple #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);
        }
Exemple #3
0
        public void ValidateWithBrokenSidecar()
        {
            // Tests the file with a sidecar
            var uri = ImageTestHelper.CreateTempFile("taglib-sample.jpg");
            var res = new GIOTagLibFileAbstraction()
            {
                Uri = uri
            };
            var sidecar_uri = ImageTestHelper.CopySidecarToTest(uri, "taglib-sample-broken.xmp");
            var sidecar_res = new GIOTagLibFileAbstraction()
            {
                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);

            XmpTag 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);
        }
Exemple #4
0
        public void ValidateWithSidecar()
        {
            // Tests the file with a sidecar
            var uri = ImageTestHelper.CreateTempFile("taglib-sample.jpg");
            var res = new GIOTagLibFileAbstraction()
            {
                Uri = uri
            };
            var sidecar_uri = ImageTestHelper.CopySidecarToTest(uri, "taglib-sample.xmp");
            var sidecar_res = new GIOTagLibFileAbstraction()
            {
                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);

            XmpTag 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);
        }
Exemple #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);

            XmpTag 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);
        }