Exemple #1
0
        public void TestRectValue()
        {
            CssStyleDeclaration csd = (CssStyleDeclaration)((CssStyleRule)cssStyleSheet.CssRules[1]).Style;
            CssValue            val = (CssValue)csd.GetPropertyCssValue("rect");

            Assert.IsTrue(val is CssPrimitiveValue);
            CssPrimitiveValue primValue = (CssPrimitiveValue)csd.GetPropertyCssValue("rect");

            Assert.AreEqual("rect(10cm 23px 45px 89px)", primValue.CssText);
            Assert.AreEqual(CssValueType.PrimitiveValue, primValue.CssValueType);
            Assert.AreEqual(CssPrimitiveType.Rect, primValue.PrimitiveType);
            IRect rect = primValue.GetRectValue();

            ICssPrimitiveValue rectValue = rect.Top;

            Assert.AreEqual(100, rectValue.GetFloatValue(CssPrimitiveType.Mm));
            Assert.AreEqual(CssPrimitiveType.Cm, rectValue.PrimitiveType);

            rectValue = rect.Right;
            Assert.AreEqual(23, rectValue.GetFloatValue(CssPrimitiveType.Px));
            Assert.AreEqual(CssPrimitiveType.Px, rectValue.PrimitiveType);

            rectValue = rect.Bottom;
            Assert.AreEqual(45, rectValue.GetFloatValue(CssPrimitiveType.Px));
            Assert.AreEqual(CssPrimitiveType.Px, rectValue.PrimitiveType);

            rectValue = rect.Left;
            Assert.AreEqual(89, rectValue.GetFloatValue(CssPrimitiveType.Px));
            Assert.AreEqual(CssPrimitiveType.Px, rectValue.PrimitiveType);
        }
Exemple #2
0
 public JsCssPrimitiveValue(ICssPrimitiveValue baseObject, ISvgScriptEngine engine)
     : base(baseObject, engine)
 {
 }