Skip to content

Commit 9275cca

Browse files
added color ramp tpo test .. broken.
1 parent e8badb9 commit 9275cca

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

py_gd/test/test_animation.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import pytest
1414

1515
from py_gd import Image, Animation, asn2array, from_array # noqa: F821
16-
16+
from py_gd.color_ramp import ColorRamp
1717

1818
HERE = Path(__file__).parent
1919

@@ -107,15 +107,23 @@ def test_animation_multi_images_colors():
107107
# Initial frame:
108108
first_frame = Image(200, 200)
109109

110+
existing_colors = first_frame.get_color_names()
111+
112+
print(existing_colors)
113+
114+
cr = ColorRamp('inferno', 0, 36, base_colorscheme=len(existing_colors))
115+
first_frame.add_colors(cr.colorlist)
116+
117+
# Initial frame:
110118
anim = Animation(outfile("test_animation_multi_colors.gif"))
111119

112120
anim.begin_anim(first_frame, 0)
113121

114122
count = 0
115123
for points in rotating_line(200):
116-
124+
color = cr.get_color_indices([count])[0]
117125
next_frame = Image(200, 200)
118-
next_frame.draw_line(points[0], points[1], 'red')
126+
next_frame.draw_line(points[0], points[1], color)
119127
anim.add_frame(next_frame)
120128
count += 1
121129

0 commit comments

Comments
 (0)