servo: Only include the test font once

Source-Repo: https://github.com/servo/servo
Source-Revision: 50a0956f1b16ac7bbd075ab1ce51a60657a01387
This commit is contained in:
Brian Anderson 2012-06-15 23:37:33 -07:00
Родитель 8876885b08
Коммит a920d4d482
2 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -182,7 +182,7 @@ fn draw_some_text(draw_target: AzDrawTargetRef) {
//let library: ft::FT_Library = ptr::null();
//ftbg::FT_Init_FreeType(ptr::addr_of(library)).for_sure();
let fontbin = #include_bin("JosefinSans-SemiBold.ttf");
let fontbin = text::font::test_font_bin();
let fontprov = vec::as_buf(fontbin) {|buf|
CGDataProviderCreateWithData(ptr::null(),
@ -326,7 +326,7 @@ fn draw_some_text(draw_target: AzDrawTargetRef) {
let library: ft::FT_Library = ptr::null();
ftbg::FT_Init_FreeType(ptr::addr_of(library)).for_sure();
let fontbin = #include_bin("JosefinSans-SemiBold.ttf");
let fontbin = text::font::test_font_bin();
let face: ft::FT_Face = ptr::null();
vec::as_buf(fontbin) {|buf|

Просмотреть файл

@ -1,4 +1,4 @@
export font, create_test_font;
export font, create_test_font, test_font_bin;
import libc::{ c_int, c_double };
import ptr::{ null, addr_of };
@ -178,10 +178,11 @@ fn get_cairo_face(buf: &[u8]) -> (*cairo_font_face_t, fn@()) {
}
fn create_test_font() -> font {
let buf = #include_bin("JosefinSans-SemiBold.ttf");
font(buf)
font(test_font_bin())
}
fn test_font_bin() -> [u8] { #include_bin("JosefinSans-SemiBold.ttf") }
fn should_destruct_on_fail_without_leaking() {
#[test];
#[should_fail];
@ -227,7 +228,7 @@ fn get_cairo_face_should_fail_and_not_leak_if_font_cant_be_created() {
fn get_cairo_face_should_return_a_new_face_and_dtor() {
#[test];
let buf = #include_bin("JosefinSans-SemiBold.ttf");
let buf = test_font_bin();
let (face, dtor) = get_cairo_face(&buf);
assert face.is_not_null();
dtor();
@ -236,7 +237,7 @@ fn get_cairo_face_should_return_a_new_face_and_dtor() {
fn get_cairo_font_should_return_a_new_font_and_dtor() {
#[test];
let buf = #include_bin("JosefinSans-SemiBold.ttf");
let buf = test_font_bin();
let (font, dtor) = get_cairo_font(&buf);
assert font.is_not_null();
dtor();