Skip to content

Commit

Permalink
tests/text: add text_animated_fixed test
Browse files Browse the repository at this point in the history
Exercises text rendering when the aspect ratio is set to 0.
  • Loading branch information
mbouron committed Mar 30, 2024
1 parent e4f0820 commit 35d9fb3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ foreach backend : backends
'vertical_lr',
'fixed',
'animated',
'animated_fixed',
]
if has_text_libraries
tests_text += [
Expand Down
5 changes: 5 additions & 0 deletions tests/refs/text_animated_fixed.ref
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0554688245546DD620E228020E826154 0554688245546DD620E228020E826154 0554688245546DD620E228020E826154 00000000000000000000000000000000
0228057826DC33C38F40980C9C3085C0 0228057826DC33C38F40980C9C3085C0 0228057826DC33C38F40980C9C3085C0 00000000000000000000000000000000
8800114488648A200E51221822080455 8800114488648A200E51221822080455 8800114488648A200E51221822080455 00000000000000000000000000000000
80401610C5C4A9713A1C838008E00204 80401610C5C4A9713A1C838008E00204 80401610C5C4A9713A1C838008E00204 00000000000000000000000000000000
C1501D00F1558F5C3887AA0C07B028C5 C1501D00F1558F5C3887AA0C07B028C5 C1501D00F1558F5C3887AA0C07B028C5 00000000000000000000000000000000
14 changes: 14 additions & 0 deletions tests/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,17 @@ def text_animated(cfg: ngl.SceneCfg):
ngl.AnimKeyFrameFloat(cfg.duration, 360),
]
return ngl.Rotate(ngl.Text("Hey"), angle=ngl.AnimatedFloat(animkf), axis=(1, 1, 1))


@test_fingerprint(width=360, height=640, tolerance=1, keyframes=5)
@ngl.scene()
def text_animated_fixed(cfg: ngl.SceneCfg):
cfg.aspect_ratio = (0, 1)
cfg.duration = 2
animkf = [
ngl.AnimKeyFrameFloat(0, 0),
ngl.AnimKeyFrameFloat(cfg.duration, 360),
]
return ngl.Rotate(
ngl.Text("Hey", scale_mode="fixed", font_scale=8), angle=ngl.AnimatedFloat(animkf), axis=(1, 1, 1)
)

0 comments on commit 35d9fb3

Please sign in to comment.