generated from saji/litex-overlay
24 lines
674 B
Python
24 lines
674 B
Python
|
from amaranth import unsigned
|
||
|
import pytest
|
||
|
|
||
|
from groovylight.common import Rgb888Layout, Rgb666Layout, RGBView
|
||
|
|
||
|
|
||
|
def test_rgbview():
|
||
|
rgb = Rgb888Layout(0xAABBCC)
|
||
|
|
||
|
assert rgb.channel_size() == unsigned(8)
|
||
|
|
||
|
rgb18 = Rgb666Layout(0x2DEFD)
|
||
|
|
||
|
slice = rgb.channel_slice(1)
|
||
|
assert isinstance(slice, RGBView), "channel_slice should return another rgbview"
|
||
|
|
||
|
assert slice.channel_size() == unsigned(1), "channel_slice channel size should be 1"
|
||
|
assert isinstance(
|
||
|
rgb18.channel_slice(5), RGBView
|
||
|
), "channel_slice should return another rgbview"
|
||
|
|
||
|
with pytest.raises(ValueError, match="Target of a view is 0 bit"):
|
||
|
rgb.channel_slice(8)
|