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:
Oriol Brufau 2023-07-27 07:04:55 +02:00 committed by GitHub
parent e0e970af31
commit e38d21d33d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 12 deletions

View file

@ -287,7 +287,7 @@ impl FloatContext {
}
/// 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.
let new_float_origin = self.place_object(&new_float, self.ceiling);
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.
#[derive(Clone, Debug)]
pub(crate) struct PlacementInfo {
pub struct PlacementInfo {
/// The *margin* box size of the object.
pub size: Vec2<Length>,
/// Whether the object is (logically) aligned to the left or right.

View file

@ -8,9 +8,9 @@
extern crate lazy_static;
use euclid::num::Zero;
use layout::flow::float::{ClearSide, FloatBand, FloatBandNode, FloatBandTree, FloatContext};
use layout::flow::float::{ContainingBlockPositionInfo, FloatSide, PlacementInfo};
use layout::geom::flow_relative::{Rect, Vec2};
use layout_2020::flow::float::{ClearSide, FloatBand, FloatBandNode, FloatBandTree, FloatContext};
use layout_2020::flow::float::{ContainingBlockPositionInfo, FloatSide, PlacementInfo};
use layout_2020::geom::flow_relative::{Rect, Vec2};
use quickcheck::{Arbitrary, Gen};
use std::f32;
use std::ops::Range;