google.charts: fix side-effects of set-query-param, add tests

char-rename
Alexander Iljin 2016-12-13 16:41:38 +03:00 committed by John Benediktsson
parent 49961e643e
commit 2c38f2e3e3
2 changed files with 36 additions and 1 deletions

View File

@ -0,0 +1,35 @@
! Copyright (C) 2016 Alexander Ilin.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors colors.constants google.charts
google.charts.private kernel present sequences tools.test ;
IN: google.charts.tests
[ f ] [
{ 0 0 } <line> COLOR: red >>background chart>url present length
{ 0 0 } <line> chart>url present length =
] unit-test
[ f ] [
{ 0 0 } <line> COLOR: red >>foreground chart>url present length
{ 0 0 } <line> chart>url present length =
] unit-test
[ f ] [
"" <formula> t >>data-scale chart>url present length
"" <formula> chart>url present length =
] unit-test
[ f ] [
{ 0 0 } <line> f >>width f >>height chart>url present length
{ 0 0 } <line> chart>url present length =
] unit-test
[ f ] [
{ 0 0 } <line> { 0 0 } >>margin chart>url present length
{ 0 0 } <line> chart>url present length =
] unit-test
[ f ] [
{ 0 0 } <line> 5 >>bar-width chart>url present length
{ 0 0 } <line> chart>url present length =
] unit-test

View File

@ -71,7 +71,7 @@ PRIVATE>
<PRIVATE <PRIVATE
: chart>url ( chart -- url ) : chart>url ( chart -- url )
[ URL" http://chart.googleapis.com/chart" ] dip { [ URL" http://chart.googleapis.com/chart" clone ] dip {
[ type>> "cht" set-query-param ] [ type>> "cht" set-query-param ]
[ [
[ width>> ] [ height>> ] bi 2dup and [ [ width>> ] [ height>> ] bi 2dup and [