Download src/Mod/TechDraw/TDTest/DrawViewAnnotationTest.py from AbdulElahGwaith/FreeCAD: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/AbdulElahGwaith/FreeCAD/resolve/main/src/Mod/TechDraw/TDTest/DrawViewAnnotationTest.py
- Command line
-
hf download hf://AbdulElahGwaith/FreeCAD/src/Mod/TechDraw/TDTest/DrawViewAnnotationTest.py
-
curl -L -o DrawViewAnnotationTest.py https://huggingface.co/AbdulElahGwaith/FreeCAD/resolve/main/src/Mod/TechDraw/TDTest/DrawViewAnnotationTest.py
1.01 kB
| import FreeCAD | |
| import unittest | |
| from .TechDrawTestUtilities import createPageWithSVGTemplate | |
| class DrawViewAnnotationTest(unittest.TestCase): | |
| def setUp(self): | |
| """Creates a page""" | |
| FreeCAD.newDocument("TDAnno") | |
| FreeCAD.setActiveDocument("TDAnno") | |
| FreeCAD.ActiveDocument = FreeCAD.getDocument("TDAnno") | |
| self.page = createPageWithSVGTemplate() | |
| def tearDown(self): | |
| FreeCAD.closeDocument("TDAnno") | |
| def testMakeAnnotation(self): | |
| """Tests if an annotation can be added to page""" | |
| anno = FreeCAD.ActiveDocument.addObject( | |
| "TechDraw::DrawViewAnnotation", "TestAnno" | |
| ) | |
| s = "Different Text" | |
| sl = list() | |
| sl.append(s) | |
| anno.Text = sl | |
| anno.TextStyle = "Bold" | |
| self.page.addView(anno) | |
| anno.X = 30.0 | |
| anno.Y = 150.0 | |
| FreeCAD.ActiveDocument.recompute() | |
| self.assertTrue("Up-to-date" in anno.State) | |
| if __name__ == "__main__": | |
| unittest.main() | |