CircuitPython version
Adafruit CircuitPython 7.0.0-beta.0 on 2021-08-24; Adafruit PyPortal with samd51j20
Adafruit CircuitPython 7.0.0-rc.1-46-g0bde894b5 on 2021-09-09; Adafruit PyPortal with samd51j20
Code/REPL
import displayio
import vectorio
line_palette = displayio.Palette(1)
line_palette[0] = 0xFFFFFF
line_one = vectorio.Rectangle(width=64, height=1, x=0, y=0, pixel_shader=line_palette)
# Test Three - Doesn't error when location is outside of signed int 16 values
line_one = vectorio.Rectangle(width=64, height=1, x=50000, y=50000, pixel_shader=line_palette)
print("Test One: Location set to (50000, 50000) but stored as", line_one.location, "It should have errored")
for i in range(0,100000,10000):
# Test Two - Doesn't error when location is outside of signed int 16 values
line_one.x = i
line_one.y = i
print("Test Two", i, line_one.location)
for i in range(0,100000,10000):
print("Test Three", i)
# Test Three - Correctly errors when location is outside of signed int 16 values
line_one.location = (i, i)
print(" T3", line_one.location)
Behavior
Test One: Location set to (50000, 50000) but stored as (-15536, -15536) It should have errored
Test Two 0 (0, 0)
Test Two 10000 (10000, 10000)
Test Two 20000 (20000, 20000)
Test Two 30000 (30000, 30000)
Test Two 40000 (-25536, -25536)
Test Two 50000 (-15536, -15536)
Test Two 60000 (-5536, -5536)
Test Two 70000 (4464, 4464)
Test Two 80000 (14464, 14464)
Test Two 90000 (24464, 24464)
Test Three 0
T3 (0, 0)
Test Three 10000
T3 (10000, 10000)
Test Three 20000
T3 (20000, 20000)
Test Three 30000
T3 (30000, 30000)
Test Three 40000
Traceback (most recent call last):
File "<stdin>", line 23, in <module>
ValueError: unsupported point type
Description
When you set the location of a vectorio shape via the constructor, the x or y properties, no bounds checking is performed. If it is set via the location property, bounds checking is performed and raises a ValueError
Additional information
No response
CircuitPython version
Code/REPL
Behavior
Description
When you set the location of a
vectorioshape via the constructor, thexoryproperties, no bounds checking is performed. If it is set via thelocationproperty, bounds checking is performed and raises aValueErrorAdditional information
No response