[TechDraw] Make annotation test a unittest

This commit is contained in:
Benjamin Bræstrup Sayoc
2022-07-25 01:52:56 +02:00
committed by WandererFan
parent 64f6249ee9
commit a9a31ad3b8
5 changed files with 61 additions and 13 deletions

View File

@@ -0,0 +1,19 @@
from __future__ import print_function
import FreeCAD
import os
def createPageWithSVGTemplate(
templateName: str = "TestTemplate.svg",
):
"""Returns a page with an SVGTemplate added on the ActiveDocument"""
print("2")
path = os.path.dirname(os.path.abspath(__file__))
print("TDTestAnno path: " + path)
templateFileSpec = path + templateName
page = FreeCAD.ActiveDocument.addObject("TechDraw::DrawPage", "Page")
FreeCAD.ActiveDocument.addObject("TechDraw::DrawSVGTemplate", "Template")
FreeCAD.ActiveDocument.Template.Template = templateFileSpec
FreeCAD.ActiveDocument.Page.Template = FreeCAD.ActiveDocument.Template
return page