Skip to content

Commit

Permalink
tests: remove use of Text.aspect_ratio
Browse files Browse the repository at this point in the history
  • Loading branch information
ubitux committed Mar 6, 2024
1 parent 5327e3f commit 954dfdb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 24 deletions.
1 change: 0 additions & 1 deletion tests/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def _get_random_text(cfg: ngl.SceneCfg, rng):
fg_color=_get_random_color(rng),
fg_opacity=_get_random_opacity(rng),
bg_opacity=0,
aspect_ratio=cfg.aspect_ratio,
)


Expand Down
4 changes: 0 additions & 4 deletions tests/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def text_arabic_shaping(cfg: ngl.SceneCfg):
return ngl.Text(
text="رَسْميّ",
font_faces=[ngl.FontFace(_ARABIC_FONT.as_posix())],
aspect_ratio=cfg.aspect_ratio,
)


Expand All @@ -130,7 +129,6 @@ def text_bidi_arabic_english(cfg: ngl.SceneCfg):
# The Latin font is placed first so the fallback is actually tested (the
# Arabic font contains Latin letters)
font_faces=[ngl.FontFace(p.as_posix()) for p in [_LATIN_FONT, _ARABIC_FONT]],
aspect_ratio=cfg.aspect_ratio,
)


Expand All @@ -143,7 +141,6 @@ def text_vertical_japanese(cfg: ngl.SceneCfg):
text="かなだけ、\nちいさいのフォント\nだから。",
writing_mode="vertical-rl",
font_faces=[ngl.FontFace(_JAPANESE_FONT.as_posix())],
aspect_ratio=cfg.aspect_ratio,
)


Expand All @@ -155,5 +152,4 @@ def text_fixed(cfg: ngl.SceneCfg):
"Fix",
scale_mode="fixed",
font_scale=4.5,
aspect_ratio=cfg.aspect_ratio,
)
28 changes: 9 additions & 19 deletions tests/texteffect.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def texteffect_color(cfg: ngl.SceneCfg):
)
)

return ngl.Text(text=text, effects=effects, aspect_ratio=cfg.aspect_ratio)
return ngl.Text(text=text, effects=effects)


@test_fingerprint(width=640, height=360, keyframes=10, tolerance=1)
Expand All @@ -76,7 +76,7 @@ def texteffect_opacity(cfg: ngl.SceneCfg):
)
]

return ngl.Text("Ghost\nin the\nText", effects=effects, aspect_ratio=cfg.aspect_ratio)
return ngl.Text("Ghost\nin the\nText", effects=effects)


@test_fingerprint(width=640, height=360, keyframes=10, tolerance=1)
Expand All @@ -102,7 +102,7 @@ def texteffect_transform(cfg: ngl.SceneCfg):
),
]

return ngl.Text("Drop me down", effects=effects, aspect_ratio=cfg.aspect_ratio)
return ngl.Text("Drop me down", effects=effects)


@test_fingerprint(width=640, height=360, keyframes=10, tolerance=1)
Expand All @@ -121,18 +121,8 @@ def texteffect_chars_space_nospace(cfg: ngl.SceneCfg):
effects1 = [ngl.TextEffect(target="char_nospace", color=ngl.AnimatedColor(animkf))]
return ngl.Group(
children=[
ngl.Text(
"AB CDE F",
effects=effects0,
aspect_ratio=cfg.aspect_ratio,
box=(-1, 0, 2, 1),
),
ngl.Text(
"AB CDE F",
effects=effects1,
aspect_ratio=cfg.aspect_ratio,
box=(-1, -1, 2, 1),
),
ngl.Text("AB CDE F", effects=effects0, box=(-1, 0, 2, 1)),
ngl.Text("AB CDE F", effects=effects1, box=(-1, -1, 2, 1)),
]
)

Expand All @@ -148,7 +138,7 @@ def texteffect_blur(cfg: ngl.SceneCfg):
ngl.AnimKeyFrameFloat(1, 0),
]
effects = [ngl.TextEffect(blur=ngl.AnimatedFloat(animkf))]
return ngl.Text("B", effects=effects, aspect_ratio=cfg.aspect_ratio)
return ngl.Text("B", effects=effects)


@test_fingerprint(width=640, height=360, keyframes=10, tolerance=1)
Expand All @@ -162,7 +152,7 @@ def texteffect_blur_outline(cfg: ngl.SceneCfg):
ngl.AnimKeyFrameFloat(1, 0),
]
effects = [ngl.TextEffect(blur=ngl.AnimatedFloat(animkf), outline=0.01)]
return ngl.Text("b", effects=effects, aspect_ratio=cfg.aspect_ratio)
return ngl.Text("b", effects=effects)


@test_fingerprint(width=640, height=360, keyframes=10, tolerance=1)
Expand All @@ -176,7 +166,7 @@ def texteffect_glow(cfg: ngl.SceneCfg):
ngl.AnimKeyFrameFloat(1, 0),
]
effects = [ngl.TextEffect(glow=ngl.AnimatedFloat(animkf), glow_color=(1, 0, 0))]
return ngl.Text("G", effects=effects, aspect_ratio=cfg.aspect_ratio)
return ngl.Text("G", effects=effects)


@test_fingerprint(width=640, height=360, keyframes=10, tolerance=2)
Expand All @@ -190,4 +180,4 @@ def texteffect_glow_outline(cfg: ngl.SceneCfg):
ngl.AnimKeyFrameFloat(1, 0),
]
effects = [ngl.TextEffect(glow=ngl.AnimatedFloat(animkf), outline=0.01)]
return ngl.Text("g", effects=effects, aspect_ratio=cfg.aspect_ratio)
return ngl.Text("g", effects=effects)

0 comments on commit 954dfdb

Please sign in to comment.