Fix servo build.

This commit is contained in:
Emilio Cobos Álvarez 2018-04-25 18:50:48 +02:00
parent 16ca8de6df
commit 54b444992d
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
13 changed files with 148 additions and 143 deletions

View file

@ -22,12 +22,13 @@ use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
use std::rc::Rc;
use style::properties::longhands::font_stretch::computed_value::T as FontStretch;
use style::properties::longhands::font_style::computed_value::T as FontStyle;
use style::properties::longhands::font_variant_caps::computed_value::T as FontVariantCaps;
use style::properties::style_structs::Font as FontStyleStruct;
use style::values::computed::Percentage;
use style::values::computed::font::{FamilyName, FamilyNameSyntax, FontFamily, FontFamilyList, FontSize};
use style::values::computed::font::{FontWeight, SingleFontFamily};
use style::values::generics::NonNegative;
use style::values::generics::font::FontStyle;
struct TestFontSource {
handle: FontContextHandle,
@ -108,7 +109,7 @@ fn style() -> FontStyleStruct {
font_variant_caps: FontVariantCaps::Normal,
font_weight: FontWeight::normal(),
font_size: FontSize::medium(),
font_stretch: FontStretch::Normal,
font_stretch: NonNegative(Percentage(1.)),
hash: 0,
};
style.compute_font_hash();

View file

@ -16,8 +16,10 @@ fn test_font_template_descriptor() {
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
use style::computed_values::font_stretch::T as FontStretch;
use style::values::computed::Percentage;
use style::values::computed::font::FontWeight;
use style::values::generics::NonNegative;
use style::values::generics::font::FontStyle;
fn descriptor(filename: &str) -> FontTemplateDescriptor {
let mut path: PathBuf = [
@ -43,25 +45,25 @@ fn test_font_template_descriptor() {
assert_eq!(descriptor("DejaVuSans"), FontTemplateDescriptor {
weight: FontWeight::normal(),
stretch: FontStretch::Normal,
italic: false,
stretch: NonNegative(Percentage(1.)),
style: FontStyle::Normal,
});
assert_eq!(descriptor("DejaVuSans-Bold"), FontTemplateDescriptor {
weight: FontWeight::bold(),
stretch: FontStretch::Normal,
italic: false,
stretch: NonNegative(Percentage(1.)),
style: FontStyle::Normal,
});
assert_eq!(descriptor("DejaVuSans-Oblique"), FontTemplateDescriptor {
weight: FontWeight::normal(),
stretch: FontStretch::Normal,
italic: true,
stretch: NonNegative(Percentage(1.)),
style: FontStyle::Italic,
});
assert_eq!(descriptor("DejaVuSansCondensed-BoldOblique"), FontTemplateDescriptor {
weight: FontWeight::bold(),
stretch: FontStretch::SemiCondensed,
italic: true,
stretch: NonNegative(Percentage(0.875)),
style: FontStyle::Italic,
});
}