- moved back the ApertureMacro class to camlib for now and made some import changes in the new ParseGerber and ParseExcellon classes
- some changes to the tests - perhaps I will try adding a few tests in the future
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import sys
|
||||
import unittest
|
||||
from PyQt4 import QtGui
|
||||
from PyQt5 import QtWidgets
|
||||
from FlatCAMApp import App
|
||||
from FlatCAMObj import FlatCAMGeometry, FlatCAMCNCjob
|
||||
from ObjectUI import GerberObjectUI, GeometryObjectUI
|
||||
from flatcamGUI.ObjectUI import GerberObjectUI, GeometryObjectUI
|
||||
from time import sleep
|
||||
import os
|
||||
import tempfile
|
||||
@@ -12,7 +12,7 @@ import tempfile
|
||||
class SVGFlowTestCase(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.app = QtGui.QApplication(sys.argv)
|
||||
self.app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
# Create App, keep app defaults (do not load
|
||||
# user-defined defaults).
|
||||
@@ -31,30 +31,28 @@ class SVGFlowTestCase(unittest.TestCase):
|
||||
names = self.fc.collection.get_names()
|
||||
print(names)
|
||||
|
||||
#--------------------------------------
|
||||
# --------------------------------------
|
||||
# Total of 1 objects.
|
||||
#--------------------------------------
|
||||
self.assertEqual(len(names), 1,
|
||||
"Expected 1 object, found %d" % len(names))
|
||||
# --------------------------------------
|
||||
self.assertEqual(len(names), 1, "Expected 1 object, found %d" % len(names))
|
||||
|
||||
#--------------------------------------
|
||||
# --------------------------------------
|
||||
# Object's name matches the file name.
|
||||
#--------------------------------------
|
||||
self.assertEqual(names[0], self.filename,
|
||||
"Expected name == %s, got %s" % (self.filename, names[0]))
|
||||
# --------------------------------------
|
||||
self.assertEqual(names[0], self.filename, "Expected name == %s, got %s" % (self.filename, names[0]))
|
||||
|
||||
#---------------------------------------
|
||||
# ---------------------------------------
|
||||
# Get object by that name, make sure it's a FlatCAMGerber.
|
||||
#---------------------------------------
|
||||
# ---------------------------------------
|
||||
geo_name = names[0]
|
||||
geo_obj = self.fc.collection.get_by_name(geo_name)
|
||||
self.assertTrue(isinstance(geo_obj, FlatCAMGeometry),
|
||||
"Expected FlatCAMGeometry, instead, %s is %s" %
|
||||
(geo_name, type(geo_obj)))
|
||||
|
||||
#----------------------------------------
|
||||
# ----------------------------------------
|
||||
# Object's GUI matches Object's options
|
||||
#----------------------------------------
|
||||
# ----------------------------------------
|
||||
# TODO: Open GUI with double-click on object.
|
||||
# Opens the Object's GUI, populates it.
|
||||
geo_obj.build_ui()
|
||||
@@ -72,9 +70,9 @@ class SVGFlowTestCase(unittest.TestCase):
|
||||
option, value, form_field.get_value()
|
||||
))
|
||||
|
||||
#------------------------------------
|
||||
# ------------------------------------
|
||||
# Open the UI, make CNCObject
|
||||
#------------------------------------
|
||||
# ------------------------------------
|
||||
geo_obj.build_ui()
|
||||
ui = geo_obj.ui
|
||||
assert isinstance(ui, GeometryObjectUI) # Just for the IDE
|
||||
@@ -91,30 +89,30 @@ class SVGFlowTestCase(unittest.TestCase):
|
||||
sleep(0.1)
|
||||
self.app.processEvents()
|
||||
|
||||
#---------------------------------------------
|
||||
# ---------------------------------------------
|
||||
# Check that only 1 object has been created.
|
||||
#---------------------------------------------
|
||||
# ---------------------------------------------
|
||||
names = self.fc.collection.get_names()
|
||||
self.assertEqual(len(names), 2,
|
||||
"Expected 2 objects, found %d" % len(names))
|
||||
|
||||
#-------------------------------------------------------
|
||||
# -------------------------------------------------------
|
||||
# Make sure the CNC Job Object has the correct name
|
||||
#-------------------------------------------------------
|
||||
# -------------------------------------------------------
|
||||
cnc_name = geo_name + "_cnc"
|
||||
self.assertTrue(cnc_name in names,
|
||||
"Object named %s not found." % geo_name)
|
||||
|
||||
#-------------------------------------------------------
|
||||
# -------------------------------------------------------
|
||||
# Get the object make sure it's a CNC Job object
|
||||
#-------------------------------------------------------
|
||||
# -------------------------------------------------------
|
||||
cnc_obj = self.fc.collection.get_by_name(cnc_name)
|
||||
self.assertTrue(isinstance(cnc_obj, FlatCAMCNCjob),
|
||||
"Expected a FlatCAMCNCJob, got %s" % type(geo_obj))
|
||||
|
||||
#-----------------------------------------
|
||||
# -----------------------------------------
|
||||
# Export G-Code, check output
|
||||
#-----------------------------------------
|
||||
# -----------------------------------------
|
||||
assert isinstance(cnc_obj, FlatCAMCNCjob)
|
||||
output_filename = ""
|
||||
# get system temporary file(try create it and delete also)
|
||||
|
||||
Reference in New Issue
Block a user