mirror of
https://github.com/servo/servo.git
synced 2025-06-16 20:34:30 +00:00
commit
ceefbe2d05
10 changed files with 10 additions and 96 deletions
|
@ -453,72 +453,3 @@ impl Font {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*fn should_destruct_on_fail_without_leaking() {
|
|
||||||
#[test];
|
|
||||||
#[should_fail];
|
|
||||||
|
|
||||||
let fctx = @FontContext();
|
|
||||||
let matcher = @FontMatcher(fctx);
|
|
||||||
let _font = matcher.get_test_font();
|
|
||||||
fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn should_get_glyph_indexes() {
|
|
||||||
#[test];
|
|
||||||
|
|
||||||
let fctx = @FontContext();
|
|
||||||
let matcher = @FontMatcher(fctx);
|
|
||||||
let font = matcher.get_test_font();
|
|
||||||
let glyph_idx = font.glyph_index('w');
|
|
||||||
assert!(glyph_idx == Some(40u as GlyphIndex));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn should_get_glyph_advance() {
|
|
||||||
#[test];
|
|
||||||
#[ignore];
|
|
||||||
|
|
||||||
let fctx = @FontContext();
|
|
||||||
let matcher = @FontMatcher(fctx);
|
|
||||||
let font = matcher.get_test_font();
|
|
||||||
let x = font.glyph_h_advance(40u as GlyphIndex);
|
|
||||||
assert!(x == 15f || x == 16f);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Testing thread safety
|
|
||||||
fn should_get_glyph_advance_stress() {
|
|
||||||
#[test];
|
|
||||||
#[ignore];
|
|
||||||
|
|
||||||
let mut ports = ~[];
|
|
||||||
|
|
||||||
for iter::repeat(100) {
|
|
||||||
let (chan, port) = pipes::stream();
|
|
||||||
ports += [@port];
|
|
||||||
spawn_named("should_get_glyph_advance_stress") {
|
|
||||||
let fctx = @FontContext();
|
|
||||||
let matcher = @FontMatcher(fctx);
|
|
||||||
let _font = matcher.get_test_font();
|
|
||||||
let x = font.glyph_h_advance(40u as GlyphIndex);
|
|
||||||
assert!(x == 15f || x == 16f);
|
|
||||||
chan.send(());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for ports.each |port| {
|
|
||||||
port.recv();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn should_be_able_to_create_instances_in_multiple_threads() {
|
|
||||||
#[test];
|
|
||||||
|
|
||||||
for iter::repeat(10u) {
|
|
||||||
do task::spawn {
|
|
||||||
let fctx = @FontContext();
|
|
||||||
let matcher = @FontMatcher(fctx);
|
|
||||||
let _font = matcher.get_test_font();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use std::rc::Rc;
|
||||||
|
|
||||||
extern mod freetype;
|
extern mod freetype;
|
||||||
extern mod fontconfig;
|
extern mod fontconfig;
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ impl Drop for FreeTypeLibraryHandle {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct FreeTypeFontContextHandle {
|
pub struct FreeTypeFontContextHandle {
|
||||||
ctx: @FreeTypeLibraryHandle,
|
ctx: Rc<FreeTypeLibraryHandle>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub impl FreeTypeFontContextHandle {
|
pub impl FreeTypeFontContextHandle {
|
||||||
|
@ -44,7 +46,7 @@ pub impl FreeTypeFontContextHandle {
|
||||||
if !result.succeeded() { fail!(); }
|
if !result.succeeded() { fail!(); }
|
||||||
|
|
||||||
FreeTypeFontContextHandle {
|
FreeTypeFontContextHandle {
|
||||||
ctx: @FreeTypeLibraryHandle { ctx: ctx },
|
ctx: Rc::new(FreeTypeLibraryHandle { ctx: ctx }),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#[crate_type = "dylib"];
|
#[crate_type = "dylib"];
|
||||||
#[crate_type = "rlib"];
|
#[crate_type = "rlib"];
|
||||||
|
|
||||||
#[feature(globs, managed_boxes, macro_rules, phase)];
|
#[feature(globs, macro_rules, phase)];
|
||||||
|
|
||||||
#[feature(phase)];
|
#[feature(phase)];
|
||||||
#[phase(syntax, link)]
|
#[phase(syntax, link)]
|
||||||
|
|
|
@ -805,23 +805,6 @@ impl Drop for BaseFlow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BoxIterator {
|
|
||||||
priv boxes: ~[@Box],
|
|
||||||
priv index: uint,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Iterator<@Box> for BoxIterator {
|
|
||||||
fn next(&mut self) -> Option<@Box> {
|
|
||||||
if self.index >= self.boxes.len() {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
let v = self.boxes[self.index].clone();
|
|
||||||
self.index += 1;
|
|
||||||
Some(v)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BaseFlow {
|
impl BaseFlow {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new(node: ThreadSafeLayoutNode) -> BaseFlow {
|
pub fn new(node: ThreadSafeLayoutNode) -> BaseFlow {
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#[comment = "The Servo Parallel Browser Project"];
|
#[comment = "The Servo Parallel Browser Project"];
|
||||||
#[license = "MPL"];
|
#[license = "MPL"];
|
||||||
|
|
||||||
#[feature(globs, macro_rules, managed_boxes, phase, thread_local)];
|
#[feature(globs, macro_rules, phase, thread_local)];
|
||||||
|
|
||||||
#[feature(phase)];
|
#[feature(phase)];
|
||||||
#[phase(syntax, link)]
|
#[phase(syntax, link)]
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#[crate_type = "dylib"];
|
#[crate_type = "dylib"];
|
||||||
#[crate_type = "rlib"];
|
#[crate_type = "rlib"];
|
||||||
|
|
||||||
#[feature(managed_boxes)];
|
|
||||||
|
|
||||||
extern crate azure;
|
extern crate azure;
|
||||||
extern crate geom;
|
extern crate geom;
|
||||||
extern crate layers;
|
extern crate layers;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#[crate_type = "dylib"];
|
#[crate_type = "dylib"];
|
||||||
#[crate_type = "rlib"];
|
#[crate_type = "rlib"];
|
||||||
|
|
||||||
#[feature(globs, managed_boxes)];
|
#[feature(globs)];
|
||||||
|
|
||||||
#[feature(phase)];
|
#[feature(phase)];
|
||||||
#[phase(syntax, link)]
|
#[phase(syntax, link)]
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#[comment = "The Servo Parallel Browser Project"];
|
#[comment = "The Servo Parallel Browser Project"];
|
||||||
#[license = "MPL"];
|
#[license = "MPL"];
|
||||||
|
|
||||||
#[feature(globs, macro_rules, struct_variant, managed_boxes, phase)];
|
#[feature(globs, macro_rules, struct_variant, phase)];
|
||||||
|
|
||||||
#[feature(phase)];
|
#[feature(phase)];
|
||||||
#[phase(syntax, link)]
|
#[phase(syntax, link)]
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#[comment = "The Servo Parallel Browser Project"];
|
#[comment = "The Servo Parallel Browser Project"];
|
||||||
#[license = "MPL"];
|
#[license = "MPL"];
|
||||||
|
|
||||||
#[feature(globs, macro_rules, managed_boxes)];
|
#[feature(globs, macro_rules)];
|
||||||
|
|
||||||
#[feature(phase)];
|
#[feature(phase)];
|
||||||
#[phase(syntax, link)] extern crate log;
|
#[phase(syntax, link)] extern crate log;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#[crate_type = "dylib"];
|
#[crate_type = "dylib"];
|
||||||
#[crate_type = "rlib"];
|
#[crate_type = "rlib"];
|
||||||
|
|
||||||
#[feature(macro_rules, managed_boxes)];
|
#[feature(macro_rules)];
|
||||||
|
|
||||||
#[feature(phase)];
|
#[feature(phase)];
|
||||||
#[phase(syntax, link)]
|
#[phase(syntax, link)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue