mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Fixed compile errors in the test suite
This commit is contained in:
parent
9196990384
commit
8a79be8698
2 changed files with 15 additions and 9 deletions
|
@ -24,6 +24,8 @@ import unsafe::reinterpret_cast;
|
|||
import vec_from_buf = vec::unsafe::from_buf;
|
||||
import ptr::addr_of;
|
||||
import dom::event::Event;
|
||||
import dvec::dvec;
|
||||
import layout::display_list::display_list;
|
||||
|
||||
type PngSink = chan<Msg>;
|
||||
|
||||
|
@ -127,7 +129,7 @@ fn sanity_check() {
|
|||
let sink = PngSink(self_channel);
|
||||
let renderer = Renderer(sink);
|
||||
|
||||
let dlist = ~[];
|
||||
let dlist : display_list = dvec();
|
||||
renderer.send(RenderMsg(dlist));
|
||||
listen(|from_renderer| {
|
||||
renderer.send(renderer::ExitMsg(from_renderer));
|
||||
|
|
|
@ -113,9 +113,10 @@ fn should_convert_text_boxes_to_solid_color_background_items() {
|
|||
let b = n.construct_boxes();
|
||||
let subbox = alt check b.kind { TextBox(subbox) { subbox } };
|
||||
b.reflow_text(px_to_au(800), subbox);
|
||||
let di = box_to_display_items(b, Point2D(px_to_au(0), px_to_au(0)));
|
||||
let list = dvec();
|
||||
box_to_display_items(list, b, Point2D(px_to_au(0), px_to_au(0)));
|
||||
|
||||
alt di[0].item_type {
|
||||
alt list[0].item_type {
|
||||
dl::display_item_solid_color(*) { }
|
||||
_ { fail }
|
||||
}
|
||||
|
@ -131,9 +132,10 @@ fn should_convert_text_boxes_to_text_items() {
|
|||
let b = n.construct_boxes();
|
||||
let subbox = alt check b.kind { TextBox(subbox) { subbox } };
|
||||
b.reflow_text(px_to_au(800), subbox);
|
||||
let di = box_to_display_items(b, Point2D(px_to_au(0), px_to_au(0)));
|
||||
let list = dvec();
|
||||
box_to_display_items(list, b, Point2D(px_to_au(0), px_to_au(0)));
|
||||
|
||||
alt di[1].item_type {
|
||||
alt list[1].item_type {
|
||||
dl::display_item_text(_) { }
|
||||
_ { fail }
|
||||
}
|
||||
|
@ -148,14 +150,15 @@ fn should_calculate_the_bounds_of_the_text_box_background_color() {
|
|||
let b = n.construct_boxes();
|
||||
let subbox = alt check b.kind { TextBox(subbox) { subbox } };
|
||||
b.reflow_text(px_to_au(800), subbox);
|
||||
let di = box_to_display_items(b, Point2D(px_to_au(0), px_to_au(0)));
|
||||
let list = dvec();
|
||||
box_to_display_items(list, b, Point2D(px_to_au(0), px_to_au(0)));
|
||||
|
||||
let expected = Rect(
|
||||
Point2D(px_to_au(0), px_to_au(0)),
|
||||
Size2D(px_to_au(84), px_to_au(20))
|
||||
);
|
||||
|
||||
assert di[0].bounds == expected;
|
||||
assert list[0].bounds == expected;
|
||||
}
|
||||
|
||||
fn should_calculate_the_bounds_of_the_text_items() {
|
||||
|
@ -167,12 +170,13 @@ fn should_calculate_the_bounds_of_the_text_items() {
|
|||
let b = n.construct_boxes();
|
||||
let subbox = alt check b.kind { TextBox(subbox) { subbox } };
|
||||
b.reflow_text(px_to_au(800), subbox);
|
||||
let di = box_to_display_items(b, Point2D(px_to_au(0), px_to_au(0)));
|
||||
let list = dvec();
|
||||
box_to_display_items(list, b, Point2D(px_to_au(0), px_to_au(0)));
|
||||
|
||||
let expected = Rect(
|
||||
Point2D(px_to_au(0), px_to_au(0)),
|
||||
Size2D(px_to_au(84), px_to_au(20))
|
||||
);
|
||||
|
||||
assert di[1].bounds == expected;
|
||||
assert list[1].bounds == expected;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue