# HG changeset patch # User Chris Cannam # Date 1493831208 -3600 # Node ID c4af57d59434d4771cbf44ea1a8a0f8b3b33b430 # Parent 21ba6000820093e2fafddc8bd57b422cb788eccf These tests now pass (in some cases by fixing the tests) diff -r 21ba60008200 -r c4af57d59434 base/ScaleTickIntervals.h --- a/base/ScaleTickIntervals.h Wed May 03 18:01:25 2017 +0100 +++ b/base/ScaleTickIntervals.h Wed May 03 18:06:48 2017 +0100 @@ -84,9 +84,10 @@ int prec = 1; if (fixed) { - prec = precInc; - if (prec < 0) { - prec = -prec; + if (precInc < 0) { + prec = -precInc; + } else if (precInc > 0) { + prec = 0; } } else { prec = precRange; diff -r 21ba60008200 -r c4af57d59434 base/test/TestScaleTickIntervals.h --- a/base/test/TestScaleTickIntervals.h Wed May 03 18:01:25 2017 +0100 +++ b/base/test/TestScaleTickIntervals.h Wed May 03 18:06:48 2017 +0100 @@ -87,13 +87,16 @@ void linear_0_5_5() { auto ticks = ScaleTickIntervals::linear({ 0, 5, 5 }); + // generally if we have some activity in the units column, we + // should add .0 to satisfy the human worry that we aren't + // being told the whole story... vector expected { - { 0, "0" }, - { 1, "1" }, - { 2, "2" }, - { 3, "3" }, - { 4, "4" }, - { 5, "5" }, + { 0, "0.0" }, + { 1, "1.0" }, + { 2, "2.0" }, + { 3, "3.0" }, + { 4, "4.0" }, + { 5, "5.0" }, }; compareTicks(ticks.ticks, expected); } @@ -102,12 +105,12 @@ { auto ticks = ScaleTickIntervals::linear({ 0, 10, 5 }); vector expected { - { 0, "0" }, - { 2, "2" }, - { 4, "4" }, - { 6, "6" }, - { 8, "8" }, - { 10, "10" } + { 0, "0.0" }, + { 2, "2.0" }, + { 4, "4.0" }, + { 6, "6.0" }, + { 8, "8.0" }, + { 10, "10.0" } }; compareTicks(ticks.ticks, expected); } @@ -186,12 +189,12 @@ { auto ticks = ScaleTickIntervals::linear({ 10000, 10010, 5 }); vector expected { - { 10000, "10000" }, - { 10002, "10002" }, - { 10004, "10004" }, - { 10006, "10006" }, - { 10008, "10008" }, - { 10010, "10010" }, + { 10000, "10000.0" }, + { 10002, "10002.0" }, + { 10004, "10004.0" }, + { 10006, "10006.0" }, + { 10008, "10008.0" }, + { 10010, "10010.0" }, }; compareTicks(ticks.ticks, expected); }