mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Remove testing feature from style crate
This commit is contained in:
parent
a6369149dc
commit
2ebce54d75
33 changed files with 63 additions and 1181 deletions
|
@ -5,17 +5,11 @@
|
|||
//! Tests for parsing and serialization of values/properties
|
||||
|
||||
use cssparser::{Parser, ParserInput};
|
||||
use euclid::ScaleFactor;
|
||||
use euclid::TypedSize2D;
|
||||
use media_queries::CSSErrorReporterTest;
|
||||
use style::context::QuirksMode;
|
||||
use style::font_metrics::ServoMetricsProvider;
|
||||
use style::media_queries::{Device, MediaType};
|
||||
use style::parser::ParserContext;
|
||||
use style::properties::{ComputedValues, StyleBuilder};
|
||||
use style::stylesheets::{CssRuleType, Origin};
|
||||
use style::values::computed::{Context, ToComputedValue};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ToCss, ParseError};
|
||||
use style_traits::{PARSING_MODE_DEFAULT, ParseError};
|
||||
|
||||
fn parse<T, F>(f: F, s: &'static str) -> Result<T, ParseError<'static>>
|
||||
where F: for<'t> Fn(&ParserContext, &mut Parser<'static, 't>) -> Result<T, ParseError<'static>> {
|
||||
|
@ -45,30 +39,6 @@ where F: Fn(&ParserContext, &mut Parser<'i, 't>) -> Result<T, ParseError<'i>> {
|
|||
parse_input(|context, parser| parser.parse_entirely(|p| f(context, p)), input)
|
||||
}
|
||||
|
||||
fn assert_computed_serialization<C, F, T>(f: F, input: &'static str, output: &str)
|
||||
where F: for<'t> Fn(&ParserContext, &mut Parser<'static, 't>) -> Result<T, ParseError<'static>>,
|
||||
T: ToComputedValue<ComputedValue=C>, C: ToCss
|
||||
{
|
||||
let viewport_size = TypedSize2D::new(0., 0.);
|
||||
let initial_style = ComputedValues::initial_values();
|
||||
let device = Device::new(MediaType::Screen, viewport_size, ScaleFactor::new(1.0));
|
||||
|
||||
let context = Context {
|
||||
is_root_element: true,
|
||||
builder: StyleBuilder::for_derived_style(&device, initial_style, None, None),
|
||||
cached_system_font: None,
|
||||
font_metrics_provider: &ServoMetricsProvider,
|
||||
in_media_query: false,
|
||||
quirks_mode: QuirksMode::NoQuirks,
|
||||
for_smil_animation: false,
|
||||
};
|
||||
|
||||
let parsed = parse(f, input).unwrap();
|
||||
let computed = parsed.to_computed_value(&context);
|
||||
let serialized = ToCss::to_css_string(&computed);
|
||||
assert_eq!(serialized, output);
|
||||
}
|
||||
|
||||
// This is a macro so that the file/line information
|
||||
// is preserved in the panic
|
||||
macro_rules! assert_roundtrip_with_context {
|
||||
|
@ -137,26 +107,20 @@ macro_rules! parse_longhand {
|
|||
|
||||
mod animation;
|
||||
mod background;
|
||||
mod basic_shape;
|
||||
mod border;
|
||||
mod box_;
|
||||
mod column;
|
||||
mod containment;
|
||||
mod effects;
|
||||
mod font;
|
||||
mod image;
|
||||
mod inherited_box;
|
||||
mod inherited_text;
|
||||
mod length;
|
||||
mod mask;
|
||||
mod outline;
|
||||
mod position;
|
||||
mod selectors;
|
||||
mod supports;
|
||||
mod text;
|
||||
mod text_overflow;
|
||||
mod transition_duration;
|
||||
mod transition_property;
|
||||
mod transition_timing_function;
|
||||
mod ui;
|
||||
mod value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue