Skip to content

Commit

Permalink
Fixed compile errors in the test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeyerho committed Jul 20, 2012
1 parent 9196990 commit 8a79be8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/servo/gfx/pngsink.rs
Expand Up @@ -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>;

Expand Down Expand Up @@ -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));
Expand Down
20 changes: 12 additions & 8 deletions src/servo/layout/display_list_builder.rs
Expand Up @@ -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 }
}
Expand All @@ -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 }
}
Expand All @@ -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() {
Expand All @@ -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;
}

0 comments on commit 8a79be8

Please sign in to comment.