diff options
| author | 2026-02-14 11:47:51 -0600 | |
|---|---|---|
| committer | 2026-02-14 12:39:07 -0600 | |
| commit | e39d994fe5c80de796806d9c7bd6b3af19c55f1a (patch) | |
| tree | af00ce9c92eb96142698b2b0c9d4f95d9b3d48df | |
| parent | No assertf either. (diff) | |
Don't make hash-dependent tests.
Older Janet versions have different hash functions - the hashing
algorithm is portable within a Janet version across architectures, but
not across different Janet versions. This can make the gold images of
colors get out of sync unexpectedly.
| -rw-r--r-- | test/gold/bar-chart.png | bin | 4055 -> 3743 bytes | |||
| -rw-r--r-- | test/gold/complex_chart.png | bin | 29684 -> 29412 bytes | |||
| -rw-r--r-- | test/suite-gfx2d.janet | 7 |
3 files changed, 6 insertions, 1 deletions
diff --git a/test/gold/bar-chart.png b/test/gold/bar-chart.png Binary files differindex 9925999..d12b2b7 100644 --- a/test/gold/bar-chart.png +++ b/test/gold/bar-chart.png diff --git a/test/gold/complex_chart.png b/test/gold/complex_chart.png Binary files differindex 5286863..1c4c99f 100644 --- a/test/gold/complex_chart.png +++ b/test/gold/complex_chart.png diff --git a/test/suite-gfx2d.janet b/test/suite-gfx2d.janet index 8d0af00..c2042f4 100644 --- a/test/suite-gfx2d.janet +++ b/test/suite-gfx2d.janet @@ -6,6 +6,9 @@ # Test charting as well (import spork/charts :as charts) +# Don't make hash dependent tests - not easily portable across verions +(setdyn charts/*color-seed* (os/cryptorand 16)) + (start-suite) (assert true) @@ -318,6 +321,7 @@ :font :olive :grid :solid :circle-points true + :color-map {:temperature-1 blue :temperature-2 green :temperature-3 yellow :temperature-4 cyan} :legend :top :legend-map (tabseq [c :in columns] c (string/replace "temperature-" "T" c)) :y-column columns)) @@ -355,10 +359,11 @@ :x-column :x :y-column :y :data {:x (range 0 11) :y (seq [x :range [0 11]] (+ 50 (* 40 (math/sin (* 1 x)))))} + :color-map {:y blue} :line-style :bar) # Lets add a legend in the top right corner - (def legend-args [:labels ["Thing 1" "Thing 2"] :frame true :padding 4]) + (def legend-args [:labels ["Thing 1" "Thing 2"] :frame true :padding 4 :color-map {"Thing 1" blue "Thing 2" green}]) (def [lw lh] (charts/draw-legend nil ;legend-args)) (def {:width vw :height vh} (unpack view)) (def legend-view (viewport view (- vw lw 10) 10 lw lh true)) |
