summaryrefslogtreecommitdiff
path: root/py/tests
diff options
context:
space:
mode:
Diffstat (limited to 'py/tests')
-rwxr-xr-xpy/tests/trans-test.py112
1 files changed, 41 insertions, 71 deletions
diff --git a/py/tests/trans-test.py b/py/tests/trans-test.py
index 8c1cfb9..7e013cb 100755
--- a/py/tests/trans-test.py
+++ b/py/tests/trans-test.py
@@ -155,20 +155,17 @@ def test_am5_trans_src():
def test_am4_normal_trans_dst():
fbs.append(pykms.DumbFramebuffer(card, w, h, "XR24"))
- fbs.append(pykms.DumbFramebuffer(card, w * 2 // 3, h, "XR24"))
- fbs.append(pykms.DumbFramebuffer(card, w * 2 // 3, h, "XR24"))
+ fbs.append(pykms.DumbFramebuffer(card, w, h, "XR24"))
fb = fbs[0]
- pykms.draw_rect(fb, 0, 0, w, h, pykms.purple)
- pykms.draw_rect(fb, 100, 50, 50, 200, pykms.green)
- pykms.draw_rect(fb, 200, 50, 50, 200, pykms.red)
- pykms.draw_rect(fb, 300, 50, 50, 200, pykms.white)
+ pykms.draw_rect(fb, 0, 0, fb.width, fb.height, pykms.purple)
+ pykms.draw_rect(fb, 100, 100, 100, 200, pykms.green)
+ pykms.draw_rect(fb, 300, 100, 100, 200, pykms.red)
+ pykms.draw_rect(fb, 500, 100, 100, 200, pykms.white)
fb = fbs[1]
- pykms.draw_rect(fb, 0, 0, fb.width, fb.height, pykms.blue)
-
- fb = fbs[2]
pykms.draw_rect(fb, 0, 0, fb.width, fb.height, pykms.cyan)
+ pykms.draw_circle(fb, 350, 200, 100, pykms.yellow)
crtc.set_props({
"trans-key-mode": 1,
@@ -181,70 +178,48 @@ def test_am4_normal_trans_dst():
plane = planes[0]
fb = fbs[0]
- plane.set_props({
- "FB_ID": fb.id,
- "CRTC_ID": crtc.id,
- "SRC_W": fb.width << 16,
- "SRC_H": fb.height << 16,
- "CRTC_W": w,
- "CRTC_H": h,
- })
-
- input("press enter\n")
-
- print("Blue bg on left, covering green, red, white boxes. Purple bg on right.")
+ z = 0
- plane = planes[1]
- fb = fbs[1]
plane.set_props({
"FB_ID": fb.id,
"CRTC_ID": crtc.id,
- "SRC_X": 0 << 16,
- "SRC_Y": 0 << 16,
"SRC_W": fb.width << 16,
"SRC_H": fb.height << 16,
- "CRTC_X": 0,
- "CRTC_Y": 0,
"CRTC_W": fb.width,
"CRTC_H": fb.height,
+ "zorder": z,
})
input("press enter\n")
- print("Blue bg on left, covering green and red boxes. Cyan bg on right, covering white box.")
+ print("Cyan bg. Green, red, white boxes. Yellow circle behind the red box.")
+
+ plane = planes[1]
+ fb = fbs[1]
+ z = 1
- plane = planes[2]
- fb = fbs[2]
plane.set_props({
"FB_ID": fb.id,
"CRTC_ID": crtc.id,
- "SRC_X": 0 << 16,
- "SRC_Y": 0 << 16,
"SRC_W": fb.width << 16,
"SRC_H": fb.height << 16,
- "CRTC_X": w // 3,
- "CRTC_Y": 0,
"CRTC_W": fb.width,
"CRTC_H": fb.height,
+ "zorder": z,
})
input("press enter\n")
def test_am4_normal_trans_src():
fbs.append(pykms.DumbFramebuffer(card, w, h, "XR24"))
- fbs.append(pykms.DumbFramebuffer(card, w // 2, h, "XR24"))
- fbs.append(pykms.DumbFramebuffer(card, w // 2, h, "XR24"))
+ fbs.append(pykms.DumbFramebuffer(card, w, h, "XR24"))
fb = fbs[0]
- pykms.draw_rect(fb, 0, 0, w, h, pykms.RGB(128, 255, 255))
- pykms.draw_rect(fb, 200, 100, 50, 200, pykms.red)
- pykms.draw_rect(fb, w - 200 - 50, 100, 50, 200, pykms.green)
+ pykms.draw_rect(fb, 0, 0, fb.width, fb.height, pykms.white)
+ pykms.draw_rect(fb, 200, 200, 100, 100, pykms.red)
+ pykms.draw_rect(fb, fb.width - 300, 200, 100, 100, pykms.green)
fb = fbs[1]
- pykms.draw_rect(fb, 0, 0, fb.width, fb.height, pykms.blue)
- pykms.draw_rect(fb, 100, 100, fb.width - 200, fb.height - 200, pykms.purple)
-
- fb = fbs[2]
pykms.draw_rect(fb, 0, 0, fb.width, fb.height, pykms.cyan)
pykms.draw_rect(fb, 100, 100, fb.width - 200, fb.height - 200, pykms.purple)
@@ -255,53 +230,42 @@ def test_am4_normal_trans_src():
"alpha_blender": 0,
})
- time.sleep(1)
+ print("White bg. Red and green boxes.")
plane = planes[0]
fb = fbs[0]
- plane.set_props({
- "FB_ID": fb.id,
- "CRTC_ID": crtc.id,
- "SRC_W": fb.width << 16,
- "SRC_H": fb.height << 16,
- "CRTC_W": w,
- "CRTC_H": h,
- })
-
- time.sleep(1)
+ z = 0
- plane = planes[1]
- fb = fbs[1]
plane.set_props({
"FB_ID": fb.id,
"CRTC_ID": crtc.id,
- "SRC_X": 0 << 16,
- "SRC_Y": 0 << 16,
"SRC_W": fb.width << 16,
"SRC_H": fb.height << 16,
- "CRTC_X": 0,
- "CRTC_Y": 0,
"CRTC_W": fb.width,
"CRTC_H": fb.height,
+ "zorder": z,
})
- time.sleep(1)
+ input("press enter\n")
+
+ print("Cyan bg. Big white box, containing red and green boxes.")
+
+ plane = planes[1]
+ fb = fbs[1]
+ z = 2
- plane = planes[2]
- fb = fbs[2]
plane.set_props({
"FB_ID": fb.id,
"CRTC_ID": crtc.id,
- "SRC_X": 0 << 16,
- "SRC_Y": 0 << 16,
"SRC_W": fb.width << 16,
"SRC_H": fb.height << 16,
- "CRTC_X": w - fb.width,
- "CRTC_Y": 0,
"CRTC_W": fb.width,
"CRTC_H": fb.height,
+ "zorder": z,
})
+ input("press enter\n")
+
def test_am4_alpha_trans_src():
fbs.append(pykms.DumbFramebuffer(card, w, h, "XR24"))
fbs.append(pykms.DumbFramebuffer(card, w // 2, h, "XR24"))
@@ -323,11 +287,12 @@ def test_am4_alpha_trans_src():
crtc.set_props({
"trans-key-mode": 1,
"trans-key": pykms.purple.rgb888,
- "background": 0,
+ "background": 0x666666,
"alpha_blender": 1,
})
- time.sleep(1)
+ print("grey background")
+ input("press enter\n")
plane = planes[0]
fb = fbs[0]
@@ -340,7 +305,8 @@ def test_am4_alpha_trans_src():
"CRTC_H": h,
})
- time.sleep(1)
+ print("grey background, red and green boxes")
+ input("press enter\n")
plane = planes[1]
fb = fbs[1]
@@ -357,7 +323,8 @@ def test_am4_alpha_trans_src():
"CRTC_H": fb.height,
})
- time.sleep(1)
+ print("left side: blue bg, purple box, red box inside purple. right side: unchanged")
+ input("press enter\n")
plane = planes[2]
fb = fbs[2]
@@ -374,6 +341,9 @@ def test_am4_alpha_trans_src():
"CRTC_H": fb.height,
})
+ print("left side: unchanged. right side: cyan bg, purple box, green box inside purple.")
+ input("press enter\n")
+
if TEST == 1:
test_am5_trans_dest()