mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Run unit tests with both layout 2013 and layout 2020 (#30032)
Since #29950, unit tests were only running with the legacy layout, and there was no way to run them for layout 2020. This patch makes './mach test-unit' run unit tests for both. Also doing some changes so that the layout 2020 floats.rs tests compile.
This commit is contained in:
parent
e0e970af31
commit
e38d21d33d
4 changed files with 8 additions and 12 deletions
|
@ -287,7 +287,7 @@ impl FloatContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Places a new float and adds it to the list. Returns the start corner of its margin box.
|
/// Places a new float and adds it to the list. Returns the start corner of its margin box.
|
||||||
pub(crate) fn add_float(&mut self, new_float: &PlacementInfo) -> Vec2<Length> {
|
pub fn add_float(&mut self, new_float: &PlacementInfo) -> Vec2<Length> {
|
||||||
// Place the float.
|
// Place the float.
|
||||||
let new_float_origin = self.place_object(&new_float, self.ceiling);
|
let new_float_origin = self.place_object(&new_float, self.ceiling);
|
||||||
let new_float_extent = match new_float.side {
|
let new_float_extent = match new_float.side {
|
||||||
|
@ -349,7 +349,7 @@ impl FloatContext {
|
||||||
|
|
||||||
/// Information needed to place an object so that it doesn't collide with existing floats.
|
/// Information needed to place an object so that it doesn't collide with existing floats.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub(crate) struct PlacementInfo {
|
pub struct PlacementInfo {
|
||||||
/// The *margin* box size of the object.
|
/// The *margin* box size of the object.
|
||||||
pub size: Vec2<Length>,
|
pub size: Vec2<Length>,
|
||||||
/// Whether the object is (logically) aligned to the left or right.
|
/// Whether the object is (logically) aligned to the left or right.
|
||||||
|
|
|
@ -8,9 +8,9 @@
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
|
|
||||||
use euclid::num::Zero;
|
use euclid::num::Zero;
|
||||||
use layout::flow::float::{ClearSide, FloatBand, FloatBandNode, FloatBandTree, FloatContext};
|
use layout_2020::flow::float::{ClearSide, FloatBand, FloatBandNode, FloatBandTree, FloatContext};
|
||||||
use layout::flow::float::{ContainingBlockPositionInfo, FloatSide, PlacementInfo};
|
use layout_2020::flow::float::{ContainingBlockPositionInfo, FloatSide, PlacementInfo};
|
||||||
use layout::geom::flow_relative::{Rect, Vec2};
|
use layout_2020::geom::flow_relative::{Rect, Vec2};
|
||||||
use quickcheck::{Arbitrary, Gen};
|
use quickcheck::{Arbitrary, Gen};
|
||||||
use std::f32;
|
use std::f32;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
|
|
|
@ -927,7 +927,6 @@ class CommandBase(object):
|
||||||
libsimpleservo=False,
|
libsimpleservo=False,
|
||||||
debug_mozjs=False, with_debug_assertions=False,
|
debug_mozjs=False, with_debug_assertions=False,
|
||||||
with_frame_pointer=False, without_wgl=False,
|
with_frame_pointer=False, without_wgl=False,
|
||||||
with_layout_2020=False, with_layout_2013=False,
|
|
||||||
**_kwargs
|
**_kwargs
|
||||||
):
|
):
|
||||||
env = env or self.build_env()
|
env = env or self.build_env()
|
||||||
|
|
|
@ -167,7 +167,7 @@ class MachCommands(CommandBase):
|
||||||
@CommandArgument('--nocapture', default=False, action="store_true",
|
@CommandArgument('--nocapture', default=False, action="store_true",
|
||||||
help="Run tests with nocapture ( show test stdout )")
|
help="Run tests with nocapture ( show test stdout )")
|
||||||
@CommandBase.build_like_command_arguments
|
@CommandBase.build_like_command_arguments
|
||||||
def test_unit(self, test_name=None, package=None, bench=False, nocapture=False, with_layout_2020=False, **kwargs):
|
def test_unit(self, test_name=None, package=None, bench=False, nocapture=False, **kwargs):
|
||||||
if test_name is None:
|
if test_name is None:
|
||||||
test_name = []
|
test_name = []
|
||||||
|
|
||||||
|
@ -200,6 +200,8 @@ class MachCommands(CommandBase):
|
||||||
self_contained_tests = [
|
self_contained_tests = [
|
||||||
"background_hang_monitor",
|
"background_hang_monitor",
|
||||||
"gfx",
|
"gfx",
|
||||||
|
"layout_2013",
|
||||||
|
"layout_2020",
|
||||||
"msg",
|
"msg",
|
||||||
"net",
|
"net",
|
||||||
"net_traits",
|
"net_traits",
|
||||||
|
@ -208,10 +210,6 @@ class MachCommands(CommandBase):
|
||||||
"servo_config",
|
"servo_config",
|
||||||
"servo_remutex",
|
"servo_remutex",
|
||||||
]
|
]
|
||||||
if with_layout_2020:
|
|
||||||
self_contained_tests.append("layout_2020")
|
|
||||||
else:
|
|
||||||
self_contained_tests.append("layout_2013")
|
|
||||||
if not packages:
|
if not packages:
|
||||||
packages = set(os.listdir(path.join(self.context.topdir, "tests", "unit"))) - set(['.DS_Store'])
|
packages = set(os.listdir(path.join(self.context.topdir, "tests", "unit"))) - set(['.DS_Store'])
|
||||||
packages |= set(self_contained_tests)
|
packages |= set(self_contained_tests)
|
||||||
|
@ -255,7 +253,6 @@ class MachCommands(CommandBase):
|
||||||
"bench" if bench else "test",
|
"bench" if bench else "test",
|
||||||
args,
|
args,
|
||||||
env=env,
|
env=env,
|
||||||
with_layout_2020=with_layout_2020,
|
|
||||||
**kwargs)
|
**kwargs)
|
||||||
|
|
||||||
@Command('test-content',
|
@Command('test-content',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue