Test: [skip ci] unit test for Commands related to PR #6889

This commit is contained in:
wmayer
2022-05-16 13:33:32 +02:00
parent a175ae63b3
commit 00fea5057c

View File

@@ -24,6 +24,7 @@
# Workbench test module
import FreeCAD, FreeCADGui, os, unittest
import tempfile
from PySide2 import QtWidgets, QtCore
from PySide2.QtWidgets import QApplication
@@ -79,3 +80,16 @@ class WorkbenchTestCase(unittest.TestCase):
def tearDown(self):
FreeCADGui.activateWorkbench(self.Active.name())
FreeCAD.Console.PrintLog(self.Active.name())
class CommandTestCase(unittest.TestCase):
def testPR6889(self):
# Fixes a crash
TempPath = tempfile.gettempdir()
macroName = TempPath + os.sep + "testmacro.py"
macroFile = open(macroName, "w")
macroFile.write("print ('Hello, World!')")
macroFile.close()
name = FreeCADGui.Command.createCustomCommand(macroName)
cmd = FreeCADGui.Command.get(name)
cmd.run()