init commit with repo structure and basic files
This commit is contained in:
parent
41ad34550b
commit
3865dcc402
13 changed files with 393 additions and 0 deletions
29
tests/labeler/domain/test_objects.py
Normal file
29
tests/labeler/domain/test_objects.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import math
|
||||
|
||||
from labeler.domain.objects import Dimension, MediaDefinition
|
||||
|
||||
|
||||
def test_dimension():
|
||||
dimension = Dimension(mm=25.4)
|
||||
|
||||
assert dimension.mm == 25.4
|
||||
assert dimension.inch == 1.0
|
||||
|
||||
assert dimension.in_pixels(dpi=300) == 300
|
||||
|
||||
assert dimension + Dimension(mm=10) == Dimension(mm=35.4)
|
||||
assert dimension * 2 == Dimension(mm=50.8)
|
||||
|
||||
assert dimension / 2 == Dimension(mm=12.7)
|
||||
|
||||
|
||||
def test_infinite_media():
|
||||
media = MediaDefinition(
|
||||
width=Dimension(mm=12),
|
||||
length=Dimension(mm=math.inf),
|
||||
minimal_margin_vertical=Dimension(mm=1),
|
||||
minimal_margin_horizontal=Dimension(mm=2),
|
||||
dpi=300,
|
||||
)
|
||||
|
||||
assert media.printable_length == Dimension(mm=math.inf)
|
||||
Loading…
Add table
Add a link
Reference in a new issue