-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
encoding utf-8 | ||
##XTHERION## xth_me_area_adjust 0 0 290.000000 260.000000 | ||
##XTHERION## xth_me_area_zoom_to 100 | ||
|
||
|
||
|
||
scrap scrap1 -projection plan -scale [0 0 96 0 0 0 200 0 inch] | ||
|
||
line u:unknown -clip off | ||
228.018 201.9699 | ||
228.018 60.5 | ||
endline | ||
|
||
line u:unknown -clip off | ||
0.5 96.7525 | ||
273.0948 96.7525 | ||
endline | ||
|
||
line u:unknown -clip off | ||
0.5 151.6229 | ||
273.0948 151.6229 | ||
endline | ||
|
||
line u:unknown -clip off | ||
107.2873 201.9699 | ||
107.2873 60.5 | ||
endline | ||
|
||
point 107.288 151.623 label -align bl -text bottom-left | ||
|
||
point 107.288 96.753 label -align l -text left | ||
|
||
point 107.288 96.753 label -align t -text top | ||
|
||
point 228.018 96.753 label -text center | ||
|
||
point 107.288 96.753 label -align b -text bottom | ||
|
||
point 107.288 96.753 label -align r -text right | ||
|
||
point 107.288 151.623 label -align br -text bottom-right | ||
|
||
point 107.288 151.623 label -align tr -text top-right | ||
|
||
point 107.288 151.623 label -align tl -text top-left | ||
|
||
endscrap | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import sys | ||
import pytest | ||
import subprocess | ||
import importlib | ||
from pathlib import Path | ||
from typing import AnyStr | ||
|
||
TESTS_DATA = Path(__file__).resolve().parent / "data" | ||
|
||
|
||
def _find_script(name: str) -> str: | ||
spec = importlib.util.find_spec(name) | ||
assert spec is not None | ||
assert spec.origin is not None | ||
return spec.origin | ||
|
||
|
||
def _non_empty_lines(buf: AnyStr) -> list[AnyStr]: | ||
return [line for line in buf.splitlines() if line] | ||
|
||
|
||
def _assert_non_empty_lines_equal(left: AnyStr, right: AnyStr): | ||
assert _non_empty_lines(left) == _non_empty_lines(right) | ||
|
||
|
||
script_th2_input = _find_script("th2_input") | ||
script_th2_output = _find_script("th2_output") | ||
|
||
|
||
@pytest.mark.parametrize("stem", [ | ||
("label-align"), | ||
]) | ||
def test_th2_round_trip(stem): | ||
path_input = TESTS_DATA / f"{stem}.th2" | ||
svgcontent = subprocess.check_output([ | ||
sys.executable, | ||
script_th2_input, | ||
str(path_input), | ||
]) | ||
th2content, stderr = subprocess.Popen( | ||
[sys.executable, script_th2_output], | ||
stdin=subprocess.PIPE, | ||
stdout=subprocess.PIPE, | ||
).communicate(svgcontent) | ||
_assert_non_empty_lines_equal(path_input.read_bytes(), th2content) |