Ejemplo n.º 1
0
    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()));
      }
    }
Ejemplo n.º 2
0
 private void ExecuteSetAttribute(XmlElement element, MagickImage image)
 {
   String name_ = Variables.GetValue<String>(element, "name");
   String value_ = Variables.GetValue<String>(element, "value");
   image.SetAttribute(name_, value_);
 }
Ejemplo n.º 3
0
    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()));
      }
    }