mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Add roundtrip parsing tests for basic_shape/position
This commit is contained in:
parent
973796b989
commit
c6feae3c5c
4 changed files with 157 additions and 1 deletions
30
tests/unit/style/parsing/position.rs
Normal file
30
tests/unit/style/parsing/position.rs
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use parsing::parse;
|
||||
use style::values::specified::position::*;
|
||||
|
||||
#[test]
|
||||
fn test_position() {
|
||||
// Serialization is not actually specced
|
||||
// though these are the values expected by basic-shape
|
||||
// https://github.com/w3c/csswg-drafts/issues/368
|
||||
assert_roundtrip!(Position::parse, "center", "50% 50%");
|
||||
assert_roundtrip!(Position::parse, "top left", "0% 0%");
|
||||
assert_roundtrip!(Position::parse, "left top", "0% 0%");
|
||||
assert_roundtrip!(Position::parse, "top right", "100% 0%");
|
||||
assert_roundtrip!(Position::parse, "right top", "100% 0%");
|
||||
assert_roundtrip!(Position::parse, "bottom left", "0% 100%");
|
||||
assert_roundtrip!(Position::parse, "left bottom", "0% 100%");
|
||||
assert_roundtrip!(Position::parse, "left center", "0% 50%");
|
||||
assert_roundtrip!(Position::parse, "right center", "100% 50%");
|
||||
assert_roundtrip!(Position::parse, "center top", "50% 0%");
|
||||
assert_roundtrip!(Position::parse, "center bottom", "50% 100%");
|
||||
assert_roundtrip!(Position::parse, "center 10px", "50% 10px");
|
||||
assert_roundtrip!(Position::parse, "center 10%", "50% 10%");
|
||||
assert_roundtrip!(Position::parse, "right 10%", "100% 10%");
|
||||
|
||||
// we don't yet handle 4-valued positions
|
||||
// https://github.com/servo/servo/issues/12690
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue