예제 #1
0
 public void TestMmValue()
 {
     length = new CssPrimitiveLengthValue("10mm", false);
     Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.Mm));
     Assert.AreEqual(1, length.GetFloatValue(CssPrimitiveType.Cm));
     Assert.AreEqual(1 / 2.54D, length.GetFloatValue(CssPrimitiveType.In));
     Assert.AreEqual(1 / 2.54D * 6, length.GetFloatValue(CssPrimitiveType.Pc));
     Assert.AreEqual(1 / 2.54D * 72, length.GetFloatValue(CssPrimitiveType.Pt));
 }
예제 #2
0
 public void TestInValue()
 {
     length = new CssPrimitiveLengthValue("10in", false);
     Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.In));
     Assert.AreEqual(10 * 2.54D, length.GetFloatValue(CssPrimitiveType.Cm));
     Assert.AreEqual(100 * 2.54D, length.GetFloatValue(CssPrimitiveType.Mm));
     Assert.AreEqual(60, length.GetFloatValue(CssPrimitiveType.Pc));
     Assert.AreEqual(720, length.GetFloatValue(CssPrimitiveType.Pt));
 }
예제 #3
0
 public void TestPtValue()
 {
     length = new CssPrimitiveLengthValue("10pt", false);
     Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.Pt), "To pt");
     Assert.AreEqual(10 / 72D * 2.54D, length.GetFloatValue(CssPrimitiveType.Cm), "To cm");
     Assert.AreEqual(100 / 72D * 2.54D, length.GetFloatValue(CssPrimitiveType.Mm), "To mm");
     Assert.AreEqual(10 / 72D, length.GetFloatValue(CssPrimitiveType.In), "To in");
     Assert.AreEqual(10 / 12D, length.GetFloatValue(CssPrimitiveType.Pc), "To pc");
 }
예제 #4
0
    public void TestPxValue()
    {
        length = new CssPrimitiveLengthValue("12px", false);
        Assert.AreEqual(12, length.GetFloatValue(CssPrimitiveType.Px));
        try
        {
            length.GetCounterValue();
            Assert.Fail("length.GetCounterValue()");
        }
        catch {}

        try
        {
            length.GetFloatValue(CssPrimitiveType.Ems);
            Assert.Fail("length.GetFloatValue(CssPrimitiveType.Ems)");
        }
        catch (DomException e)
        {
            Assert.AreEqual(DomExceptionType.InvalidAccessErr, e.Code);
        }
    }
예제 #5
0
 public void TestUnitLessValue()
 {
     length = new CssPrimitiveLengthValue("10", false);
     Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.Number));
 }
예제 #6
0
 public void TestPercentageValue()
 {
     length = new CssPrimitiveLengthValue("10%", false);
     Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.Percentage), "To %");
 }
예제 #7
0
 public void TestExValue()
 {
     length = new CssPrimitiveLengthValue("10ex", false);
     Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.Exs), "To ex");
 }