Enable resetable and String prefs.

This allows both boolean and string-type preferences. It
also implements a system where prefs that are read from a
configuration file can be reset back to their initial value,
which is useful in a number of cases e.g. when running tests
to ensure that each test starts with the same values for
the prefs.
This commit is contained in:
James Graham 2015-09-17 00:49:05 +01:00
parent d811f2d1ba
commit 79e548905e
10 changed files with 174 additions and 33 deletions

View file

@ -26,7 +26,8 @@ fn test_viewport_rule<F>(css: &str,
callback: F)
where F: Fn(&Vec<ViewportDescriptorDeclaration>, &str)
{
::util::prefs::set_pref("layout.viewport.enabled", true);
::util::prefs::set_pref("layout.viewport.enabled",
::util::prefs::PrefValue::Boolean(true));
let stylesheet = stylesheet!(css, Author);
let mut rule_count = 0;
@ -173,7 +174,8 @@ fn cascading_within_viewport_rule() {
#[test]
fn multiple_stylesheets_cascading() {
::util::prefs::set_pref("layout.viewport.enabled", true);
::util::prefs::set_pref("layout.viewport.enabled",
::util::prefs::PrefValue::Boolean(true));
let device = Device::new(MediaType::Screen, Size2D::typed(800., 600.));
let stylesheets = vec![