Add parsing of double values in style attributes

This commit is contained in:
Keith Yeung 2016-04-12 18:01:09 -04:00
parent 84ab7e9fe8
commit 48b2e9c055
11 changed files with 132 additions and 14 deletions

View file

@ -6,6 +6,15 @@ use app_units::Au;
use style::attr::{AttrValue, parse_length};
use util::str::{DOMString, LengthOrPercentageOrAuto};
#[test]
fn test_parse_double() {
let value = DOMString::from("432.5e2");
match AttrValue::from_double(value, 0.0) {
AttrValue::Double(_, num) => assert_eq!(num, 43250f64),
_ => panic!("expected a double value")
}
}
#[test]
fn test_from_limited_i32_should_be_default_when_less_than_0() {
let value = DOMString::from("-1");