mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #10608 - KiChjang:parse-double, r=nox
Add parsing of double values in style attributes <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10608) <!-- Reviewable:end -->
This commit is contained in:
commit
ccba2d6841
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