From c84f4c8776b841e48a8d997b11c296a2763d741a Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 28 Apr 2011 15:48:59 +0200 Subject: [PATCH] Bug 590181 part 1 - Fix tests to avoid rounding errors. Original patch from jlebar. r=dbaron --- layout/reftests/bugs/368020-5.html | 2 +- .../css-calc/border-radius-1-ref.html | 6 +-- layout/reftests/css-calc/border-radius-1.html | 16 ++++++-- .../test/test_transitions_per_property.html | 41 +++++++++++-------- 4 files changed, 40 insertions(+), 25 deletions(-) diff --git a/layout/reftests/bugs/368020-5.html b/layout/reftests/bugs/368020-5.html index 42dc1ed66fb..e120e842c82 100644 --- a/layout/reftests/bugs/368020-5.html +++ b/layout/reftests/bugs/368020-5.html @@ -5,7 +5,7 @@ - + blah
blah
blah diff --git a/layout/reftests/css-calc/border-radius-1-ref.html b/layout/reftests/css-calc/border-radius-1-ref.html index a8463c3f251..e5de63e6c6e 100644 --- a/layout/reftests/css-calc/border-radius-1-ref.html +++ b/layout/reftests/css-calc/border-radius-1-ref.html @@ -3,10 +3,10 @@ diff --git a/layout/reftests/css-calc/border-radius-1.html b/layout/reftests/css-calc/border-radius-1.html index 6726cb50649..16af05680ac 100644 --- a/layout/reftests/css-calc/border-radius-1.html +++ b/layout/reftests/css-calc/border-radius-1.html @@ -3,10 +3,20 @@ diff --git a/layout/style/test/test_transitions_per_property.html b/layout/style/test/test_transitions_per_property.html index 61defdb0b09..544e15215d6 100644 --- a/layout/style/test/test_transitions_per_property.html +++ b/layout/style/test/test_transitions_per_property.html @@ -555,8 +555,10 @@ function test_radius_transition(prop) { // FIXME: Test a square for now, since we haven't updated to the spec // for vertical components being relative to the height. - div.style.setProperty("width", "200px", ""); - div.style.setProperty("height", "200px", ""); + // Note: We use powers of two here so the floating-point math comes out + // nicely. + div.style.setProperty("width", "256px", ""); + div.style.setProperty("height", "256px", ""); div.style.setProperty("border", "none", ""); div.style.setProperty("padding", "0", ""); @@ -570,14 +572,14 @@ function test_radius_transition(prop) { "radius-valued property " + prop + ": interpolation of radius"); check_distance(prop, "3px", "6px", "15px"); div.style.setProperty("-moz-transition-property", "none", ""); - div.style.setProperty(prop, "5%", ""); - is(cs.getPropertyValue(prop), "10px", + div.style.setProperty(prop, "12.5%", ""); + is(cs.getPropertyValue(prop), "32px", "radius-valued property " + prop + ": computed value before transition"); div.style.setProperty("-moz-transition-property", prop, ""); div.style.setProperty(prop, "25%", ""); - is(cs.getPropertyValue(prop), "20px", + is(cs.getPropertyValue(prop), "40px", "radius-valued property " + prop + ": interpolation of radius"); - check_distance(prop, "5%", "10%", "25%"); + check_distance(prop, "12.5%", "15.625%", "25%"); div.style.setProperty("-moz-transition-property", "none", ""); div.style.setProperty(prop, "3px 8px", ""); is(cs.getPropertyValue(prop), "3px 8px", @@ -588,24 +590,25 @@ function test_radius_transition(prop) { "radius-valued property " + prop + ": interpolation of radius"); check_distance(prop, "3px 8px", "6px 9px", "15px 12px"); div.style.setProperty("-moz-transition-property", "none", ""); - div.style.setProperty(prop, "5% 15%", ""); - is(cs.getPropertyValue(prop), "10px 30px", + div.style.setProperty(prop, "12.5% 6.25%", ""); + is(cs.getPropertyValue(prop), "32px 16px", "radius-valued property " + prop + ": computed value before transition"); div.style.setProperty("-moz-transition-property", prop, ""); div.style.setProperty(prop, "25%", ""); - is(cs.getPropertyValue(prop), "20px 35px", + is(cs.getPropertyValue(prop), "40px 28px", "radius-valued property " + prop + ": interpolation of radius"); - check_distance(prop, "5% 15%", "10% 17.5%", "25%"); + check_distance(prop, "12.5% 6.25%", "15.625% 10.9375%", "25%"); div.style.setProperty("-moz-transition-property", "none", ""); - div.style.setProperty(prop, "8% 12%", ""); - is(cs.getPropertyValue(prop), "16px 24px", + div.style.setProperty(prop, "6.25% 12.5%", ""); + is(cs.getPropertyValue(prop), "16px 32px", "radius-valued property " + prop + ": computed value before transition"); div.style.setProperty("-moz-transition-property", prop, ""); - div.style.setProperty(prop, "40px 20px", ""); - is(cs.getPropertyValue(prop), "22px 23px", + div.style.setProperty(prop, "64px 16px", ""); + is(cs.getPropertyValue(prop), "28px", "radius-valued property " + prop + ": interpolation of radius with mixed units"); - check_distance(prop, "8% 12%", "-moz-calc(6% + 10px) -moz-calc(5px + 9%)", - "40px 20px"); + check_distance(prop, "6.25% 12.5%", + "-moz-calc(4.6875% + 16px) -moz-calc(9.375% + 4px)", + "64px 16px"); test_length_percent_calc_transition(prop); @@ -914,9 +917,11 @@ function test_transform_transition(prop) { expected_uncomputed: 'translateY(-30%)', expected: 'matrix(1, 0, 0, 1, 0px, -15px)' }, { start: 'none', end: 'rotate(90deg) translate(20%, 20%) rotate(-90deg)', - expected_uncomputed: 'rotate(22.5deg) translate(5%, 5%) rotate(-22.5deg)' }, + expected_uncomputed: 'rotate(22.5deg) translate(5%, 5%) rotate(-22.5deg)', + round_error_ok: true }, { start: 'none', end: 'rotate(-90deg) translate(20%, 20%) rotate(90deg)', - expected_uncomputed: 'rotate(-22.5deg) translate(5%, 5%) rotate(22.5deg)' }, + expected_uncomputed: 'rotate(-22.5deg) translate(5%, 5%) rotate(22.5deg)', + round_error_ok: true }, // test percent translation using matrix decomposition { start: 'rotate(45deg) rotate(-45deg)', end: 'rotate(90deg) translate(20%, 20%) rotate(-90deg)',