mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
Add parsing of double values in style attributes
This commit is contained in:
parent
84ab7e9fe8
commit
48b2e9c055
11 changed files with 132 additions and 14 deletions
|
@ -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");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue