mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Change LengthOrPercentageOrAuto to make use of NoCalcLength
This commit is contained in:
parent
590c9579f0
commit
bdb08b9a82
5 changed files with 35 additions and 42 deletions
|
@ -19,7 +19,7 @@ fn property_declaration_block_should_serialize_correctly() {
|
|||
|
||||
let declarations = vec![
|
||||
(PropertyDeclaration::Width(
|
||||
DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(70f32)))),
|
||||
DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)))),
|
||||
Importance::Normal),
|
||||
|
||||
(PropertyDeclaration::MinHeight(
|
||||
|
@ -27,7 +27,7 @@ fn property_declaration_block_should_serialize_correctly() {
|
|||
Importance::Normal),
|
||||
|
||||
(PropertyDeclaration::Height(
|
||||
DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(20f32)))),
|
||||
DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(20f32)))),
|
||||
Importance::Important),
|
||||
|
||||
(PropertyDeclaration::Display(
|
||||
|
@ -113,7 +113,7 @@ mod shorthand_serialization {
|
|||
fn all_equal_properties_should_serialize_to_one_value() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let px_70 = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(70f32)));
|
||||
let px_70 = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)));
|
||||
properties.push(PropertyDeclaration::MarginTop(px_70.clone()));
|
||||
properties.push(PropertyDeclaration::MarginRight(px_70.clone()));
|
||||
properties.push(PropertyDeclaration::MarginBottom(px_70.clone()));
|
||||
|
@ -127,8 +127,8 @@ mod shorthand_serialization {
|
|||
fn equal_vertical_and_equal_horizontal_properties_should_serialize_to_two_value() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let vertical_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(10f32)));
|
||||
let horizontal_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(5f32)));
|
||||
let vertical_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(10f32)));
|
||||
let horizontal_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(5f32)));
|
||||
|
||||
properties.push(PropertyDeclaration::MarginTop(vertical_px.clone()));
|
||||
properties.push(PropertyDeclaration::MarginRight(horizontal_px.clone()));
|
||||
|
@ -143,9 +143,9 @@ mod shorthand_serialization {
|
|||
fn different_vertical_and_equal_horizontal_properties_should_serialize_to_three_values() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let top_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(8f32)));
|
||||
let bottom_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(10f32)));
|
||||
let horizontal_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(5f32)));
|
||||
let top_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(8f32)));
|
||||
let bottom_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(10f32)));
|
||||
let horizontal_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(5f32)));
|
||||
|
||||
properties.push(PropertyDeclaration::MarginTop(top_px));
|
||||
properties.push(PropertyDeclaration::MarginRight(horizontal_px.clone()));
|
||||
|
@ -160,10 +160,10 @@ mod shorthand_serialization {
|
|||
fn different_properties_should_serialize_to_four_values() {
|
||||
let mut properties = Vec::new();
|
||||
|
||||
let top_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(8f32)));
|
||||
let right_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(12f32)));
|
||||
let bottom_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(10f32)));
|
||||
let left_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(Length::from_px(14f32)));
|
||||
let top_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(8f32)));
|
||||
let right_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(12f32)));
|
||||
let bottom_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(10f32)));
|
||||
let left_px = DeclaredValue::Value(LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(14f32)));
|
||||
|
||||
properties.push(PropertyDeclaration::MarginTop(top_px));
|
||||
properties.push(PropertyDeclaration::MarginRight(right_px));
|
||||
|
@ -738,8 +738,8 @@ mod shorthand_serialization {
|
|||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(Length::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(Length::from_px(50f32))
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
);
|
||||
|
@ -798,8 +798,8 @@ mod shorthand_serialization {
|
|||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(Length::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(Length::from_px(50f32))
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
);
|
||||
|
@ -934,8 +934,8 @@ mod shorthand_serialization {
|
|||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(Length::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(Length::from_px(50f32))
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
);
|
||||
|
@ -988,8 +988,8 @@ mod shorthand_serialization {
|
|||
let size = single_vec_variant_value!(size,
|
||||
size::single_value::SpecifiedValue::Explicit(
|
||||
size::single_value::ExplicitSize {
|
||||
width: LengthOrPercentageOrAuto::Length(Length::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(Length::from_px(50f32))
|
||||
width: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(70f32)),
|
||||
height: LengthOrPercentageOrAuto::Length(NoCalcLength::from_px(50f32))
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue