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)); }
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)); }
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"); }
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); } }
public void TestUnitLessValue() { length = new CssPrimitiveLengthValue("10", false); Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.Number)); }
public void TestPercentageValue() { length = new CssPrimitiveLengthValue("10%", false); Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.Percentage), "To %"); }
public void TestExValue() { length = new CssPrimitiveLengthValue("10ex", false); Assert.AreEqual(10, length.GetFloatValue(CssPrimitiveType.Exs), "To ex"); }