Files
omarchy/plugins/io.github.x3me.nexthop/test/test_pathspark.py
T
asepharyana 1cdb82a76f Sync config from arch
- hypr/apps.lua
- hypr/autostart.lua
- hypr/envs.lua
- hypr/hyprland.lua
- hypr/hyprsunset.conf
- hypr/input.lua
- hypr/looknfeel.lua
- hypr/omasettings.lua
- hypr/xdph.conf
- omarchy/branding/about.txt
- omarchy/branding/screensaver.txt
- omarchy/extensions/omarchy-menu.jsonc
- omarchy/hooks/battery-low.d/play-warning-sound.sample
- omarchy/hooks/font-set.d/show-font-notification.sample
- omarchy/hooks/post-boot.d/weather.sample
- omarchy/hooks/post-update.d/install-voxtype.hook
- omarchy/hooks/post-update.d/setup-agent.hook
- omarchy/hooks/post-update.d/setup-fingerprint.hook
- omarchy/hooks/post-update.d/show-update-notification.sample
- omarchy/hooks/pre-refresh-pacman.d/add-custom-repo.sample
- omarchy/hooks/theme-set.d/show-theme-notification.sample
- omarchy/shell.json
- omarchy/shell.toml
- omarchy/theme.name
- omarchy/themes/azure-glow/README.md
- omarchy/themes/azure-glow/alacritty.toml
- omarchy/themes/azure-glow/btop.theme
- omarchy/themes/azure-glow/hyprland.conf
- omarchy/themes/azure-glow/hyprlock.conf
- omarchy/themes/azure-glow/icons.theme
- … 269 more
2026-09-23 15:19:12 +07:00

40 lines
1.4 KiB
Python

"""The sparkline geometry, checked in a real JS engine.
`pathspark.js` is plain JavaScript beside the QML, which puts it outside
everything else in the battery: qmllint does not evaluate it and the
Python suite cannot import it. Two geometry defects shipped from it in a
single day — the ring on the wrong slot, then the ring drawn half outside
the canvas — and neither could have failed a test that existed.
`draw()` takes a context and a size and calls nothing else, so a fake 2d
context recording every mark is enough. The harness is
`test/pathspark_bounds.js`; this runs it. Skipped where node is absent
(the runner-like PATH), so it is CI that enforces it.
"""
import shutil
import subprocess
import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from support import REPO # noqa: E402
HARNESS = REPO / "test" / "pathspark_bounds.js"
class SparklineGeometry(unittest.TestCase):
def test_nothing_is_drawn_outside_the_canvas(self):
node = shutil.which("node")
if not node:
self.skipTest("node not on PATH")
r = subprocess.run([node, str(HARNESS)], capture_output=True,
text=True, timeout=60)
self.assertEqual(r.returncode, 0,
f"{r.stdout}\n{r.stderr}")
self.assertIn("all inside the canvas", r.stdout)
if __name__ == "__main__":
unittest.main()