diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-17 07:27:25 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-01-17 07:27:25 +0000 |
commit | 715f2617dffdcede45af45e5e849cb83f67745b4 (patch) | |
tree | 53e36520f98150d4e6ca3e4e2f44f5837827cf34 | |
parent | be1ec90210885935d3b6b9d6ccc36bdc12717192 (diff) | |
download | libcss-715f2617dffdcede45af45e5e849cb83f67745b4.tar.gz libcss-715f2617dffdcede45af45e5e849cb83f67745b4.tar.bz2 |
Make makefixed.pl round to nearest integer, rather than truncating towards zero.
Add a test for negative fractions to properties.dat
svn path=/trunk/libcss/; revision=6110
-rwxr-xr-x | test/data/parse/makefixed.pl | 12 | ||||
-rw-r--r-- | test/data/parse/properties.dat | 8 |
2 files changed, 19 insertions, 1 deletions
diff --git a/test/data/parse/makefixed.pl b/test/data/parse/makefixed.pl index 712784f..1a9306f 100755 --- a/test/data/parse/makefixed.pl +++ b/test/data/parse/makefixed.pl @@ -7,5 +7,15 @@ die "Usage: makefixed.pl <value>\n" if (@ARGV != 1); my $val = shift @ARGV; -printf("0x%.8x\n", $val * (1 << 10)); +$val *= (1 << 10); + +# Round away from zero +if ($val < 0) { + $val -= 0.5; +} else { + $val += 0.5; +} + +# Truncates back towards zero +printf("0x%.8x\n", $val); diff --git a/test/data/parse/properties.dat b/test/data/parse/properties.dat index c2f4f48..bc09a04 100644 --- a/test/data/parse/properties.dat +++ b/test/data/parse/properties.dat @@ -122,6 +122,14 @@ | 0x02000000 0x00000324 0x00000202 #reset +#data +* { azimuth: -0.785rad; } +#errors +#expected +| 1 * +| 0x02000000 0xfffffcdc 0x00000202 +#reset + ## ## 01 - background-attachment ## |