public void Test_Attribute()
    {
      using (MagickImage image = new MagickImage(Files.ImageMagickJPG))
      {
        Assert.IsNull(image.GetAttribute("test"));

        IEnumerable<string> names = image.AttributeNames;
        Assert.AreEqual(4, names.Count());

        image.SetAttribute("test", "");
        Assert.AreEqual(null, image.GetAttribute("test"));

        image.SetAttribute("test", "123");
        Assert.AreEqual("123", image.GetAttribute("test"));

        image.SetArtifact("foo", "bar");

        names = image.AttributeNames;
        Assert.AreEqual(5, names.Count());
        Assert.AreEqual("date:create,date:modify,jpeg:colorspace,jpeg:sampling-factor,test", string.Join(",", (from name in names
                                                                                                               orderby name
                                                                                                               select name).ToArray()));
      }
    }
Beispiel #2
0
 private void ExecuteSetArtifact(XmlElement element, MagickImage image)
 {
   String name_ = Variables.GetValue<String>(element, "name");
   String value_ = Variables.GetValue<String>(element, "value");
   image.SetArtifact(name_, value_);
 }
    public void Test_Artifact()
    {
      using (MagickImage image = new MagickImage(Files.SnakewarePNG))
      {
        Assert.IsNull(image.GetArtifact("test"));

        image.SetArtifact("test", "");
        Assert.AreEqual(null, image.GetArtifact("test"));

        image.SetArtifact("test", "123");
        Assert.AreEqual("123", image.GetArtifact("test"));

        image.SetAttribute("foo", "bar");

        IEnumerable<string> names = image.ArtifactNames;
        Assert.AreEqual(1, names.Count());
        Assert.AreEqual("test", string.Join(",", (from name in names
                                                  orderby name
                                                  select name).ToArray()));
      }
    }