Skip to content

Commit

Permalink
Test code for copy
Browse files Browse the repository at this point in the history
  • Loading branch information
justvanrossum committed Sep 5, 2023
1 parent 8985d7a commit bd2d310
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test-py/test_backend_copy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import pathlib
import subprocess

from test_backend_designspace import fileNamesFromDir

from fontra.backends import getFileSystemBackend, newFileSystemBackend
from fontra.backends.copy import copyFont

mutatorDSPath = (
pathlib.Path(__file__).resolve().parent
/ "data"
/ "mutatorsans"
/ "MutatorSans.designspace"
)


async def test_copyFont(tmpdir):
tmpdir = pathlib.Path(tmpdir)
destPath = tmpdir / "MutatorCopy.designspace"
sourceFont = getFileSystemBackend(mutatorDSPath)
destFont = newFileSystemBackend(destPath)
await copyFont(sourceFont, destFont)
assert [
"MutatorCopy.designspace",
"MutatorCopy_BoldCondensed.ufo",
"MutatorCopy_BoldWide.ufo",
"MutatorCopy_LightWide.ufo",
"MutatorCopy_Regular.ufo",
] == fileNamesFromDir(tmpdir)


def test_fontra_copy(tmpdir):
tmpdir = pathlib.Path(tmpdir)
destPath = tmpdir / "MutatorCopy.designspace"
subprocess.run(["fontra-copy", mutatorDSPath, destPath])
assert [
"MutatorCopy.designspace",
"MutatorCopy_BoldCondensed.ufo",
"MutatorCopy_BoldWide.ufo",
"MutatorCopy_LightWide.ufo",
"MutatorCopy_Regular.ufo",
] == fileNamesFromDir(tmpdir)

0 comments on commit bd2d310

Please sign in to comment.