Ejemplo n.º 1
0
 def test_forbidden_halt2(self):
     P[4143] = 1
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "其他功能")
     th.msleep(1000)
     # self.win = th.assertActiveWindow(basic.otherDialog)
     # 登录操作员
     self.win = QtWidgets.QApplication.activeWindow()
     if self.win.windowTitle() == "其他功能":
         th.clickButton(self.win, "用户管理")
         self.win = th.assertActiveWindow(basic.UserManagementDialog)
         th.clickButton(self.win, "操作员登录")
         th.msleep(500)
         th.close(self.win)
         th.msleep(1000)
         assert basic.Auth_Level() == 20
         th.assertActiveWindow(basic.mainWindow)
         th.clickButton(basic.mainWindow, "坐标设定")
         th.msleep(1000)
         th.assertActiveWindow(basic.mainWindow)
         P[4143] = 0
         th.clickButton(basic.mainWindow, "坐标设定")
         th.msleep(1000)
         win = th.assertActiveWindow(CoordinateDialog)
         th.close(win)
Ejemplo n.º 2
0
 def test_UseMultiCoordinate(self):
     th.msleep(500)
     # 勾选“使用多坐标系”
     P[4305] = 1
     th.msleep(1000)
     # # 设置每个坐标系的工件坐标和材料厚度
     lineEdit_x = self.win.ui.offset_x
     lineEdit_y = self.win.ui.offset_y
     thickness = self.win.ui.groupBox_4.findChildren(QtWidgets.QLineEdit)
     th.msleep(1000)
     offsetx = 160
     offsety = -160
     for wcs in ["G54", "G55", "G56", "G57", "G58", "G59"]:
         offsetx = offsetx - 10
         offsety = offsety + 10
         th.clickButton(self.win, wcs)
         th.lineEditTypewrite(str(offsetx), lineEdit_x)
         th.lineEditTypewrite(str(offsety), lineEdit_y)
         for i in thickness:
             th.lineEditTypewrite("-50", i)
         th.msleep(1000)
     th.close(self.win)
     th.msleep(1000)
     self.win = th.assertActiveWindow(basic.mainWindow)
     # 加载NC程序
     th.loadProgram("E:/NC/自动测试程序/多坐标系.NC")
     th.msleep(2000)
     # 进行仿真
     th.clickButton(basic.mainWindow, "仿真")
     th.msleep(1000)
     self.win = th.assertActiveWindow(Simu3dDialog)
     th.moveTo(widget=self.win.ui.widget)
     th.msleep(1000)
     th.rightClick()
     th.msleep(1000)
     th.assertActiveMenu()
     th.clickMenu("俯视图")
     th.msleep(1000)
     th.rightClick()
     th.msleep(1000)
     th.assertActiveMenu()
     th.clickMenu("标尺")
     self.win = th.assertActiveWindow(Simu3dDialog)
     th.clickButton(self.win, "连续仿真")
     th.msleep(1000)
     # 输出仿真图形
     th.screenshot()
     th.msleep(1000)
     # 关闭仿真对话框
     th.close(self.win)
     # # 取消勾选“使用多坐标系”
     P[4305] = 0
     th.msleep(1000)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "坐标设定")
     th.msleep(1000)
     self.win = th.assertActiveWindow(CoordinateDialog)
     self.assertTrue(self.win.ui.G54.isEnabled())
     self.assertFalse(self.win.ui.G55.isEnabled())
Ejemplo n.º 3
0
 def test_SafeHight(self):
     P[4005] = 40
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(5000)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F12 停止")
     th.msleep(500)
     # 清空仿真图形
     th.clickButton(basic.mainWindow, "仿真")
     th.msleep(1000)
     win = th.assertActiveWindow(Simu3dDialog)
     th.moveTo(widget=win.ui.widget)
     th.msleep(1000)
     th.rightClick()
     th.msleep(1000)
     th.assertActiveMenu()
     th.clickMenu("清空")
     th.msleep(500)
     th.close(win)
     th.msleep(1000)
     # 从断点行开始加工
     th.moveTo(widget=th._mainWindowContent.ui.tableView)
     th.msleep(500)
     th.rightClick()
     th.msleep(500)
     th.assertActiveMenu()
     th.clickMenu("从断点行开始加工")
     th.msleep(500)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(3000)
     # 查看仿真图形
     th.clickButton(basic.mainWindow, "仿真")
     th.msleep(1000)
     win = th.assertActiveWindow(Simu3dDialog)
     th.moveTo(widget=win.ui.widget)
     th.msleep(1000)
     # 切换到前视图
     th.rightClick()
     th.msleep(1000)
     th.assertActiveMenu()
     th.clickMenu("前视图")
     th.msleep(1000)
     # 打开标尺
     win = th.assertActiveWindow(Simu3dDialog)
     win.ui.widget.m_isRuler = True
     th.msleep(1000)
     # 输出仿真图形
     th.screenshot()
     th.msleep(1000)
     # 关闭仿真对话框
     th.close(win)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F12 停止")
Ejemplo n.º 4
0
    def test_Tool(self):
        # 加载测试程序
        basic.loadProgram("E:/NC/自动测试程序/分别外形尺寸补偿功能测试程序.NC")
        th.msleep(500)
        th.close(self.tool)
        th.msleep(500)
        # 判断刀具全部勾选
        th.clickButton(basic.mainWindow, "F11开始")
        th.msleep(1000)
        assert basic.GetMainToolNo() == 1
        th.msleep(8000)
        assert basic.GetMainToolNo() == 2
        th.msleep(3000)
        assert basic.GetMainToolNo() == 3
        th.msleep(3000)
        assert F[3]

        # 判断未勾选任何刀具
        th.clickButton(basic.mainWindow, "刀具")
        tool = th.assertActiveWindow(basic.ToolDialog)
        th.msleep(500)
        th.clickButton(tool, "反选")
        th.msleep(500)
        th.close(tool)
        th.msleep(500)
        th.clickButton(basic.mainWindow, "F11开始")
        th.msleep(1000)
        # 如果弹出Qmessagebox则没有勾选任何刀具
        msg = th.assertActiveWindow(QtWidgets.QMessageBox)
        th.clickButton(msg, "取消")

        # 在刀具名称那一栏输入值
        th.clickButton(basic.mainWindow, "刀具")
        th.msleep(500)
        # print(table[0].item(0, 2).text())
        th.clickButton(self.tool, "全选")
        th.msleep(500)
        # 定义包含所有数字,字母和特殊字符的字符串
        s1 = string.digits + string.ascii_letters + '~{}!@#$%^&*()><?-+='
        # 随机给刀具名称列表输入值
        for i in range(self.table[0].rowCount()):
            text = "".join(random.choice(s1) for j in range(10, 30))
            self.table[0].item(i, 2).setText(text)
        th.msleep(1000)
        # 判断输入的字符串有没有保存
        # assert self.list_name[i] != table[0].item(i,2).text()
        th.msleep(500)
        # 卸载NC程序
        basic.unloadProgram()
        th.msleep(1000)
        basic.loadProgram("E:/NC/自动测试程序/2013样条曲线圆弧拟合.NC")
        th.msleep(1000)
        basic.unloadProgram()
        th.msleep(1000)
        basic.loadProgram("E:/NC/自动测试程序/分别外形尺寸补偿功能测试程序.NC")
        # 刀具半径只可输入数字不可输入字符串
        for i in range(self.table[0].rowCount()):
            num = str(round(random.uniform(0, 1000), 3))
            self.table[0].item(i, 4).setText(num)
        th.msleep(1000)

        for i in range(self.table[0].rowCount()):
            text = "".join(random.choice(s1) for j in range(5, 15))
            self.table[0].item(i, 5).setText(text)
        th.msleep(1000)

        # 刀具寿命
        th.msleep(500)
        th.lineEditTypewrite(
            "10", tool.findChild(QtWidgets.QLineEdit, "toolmaxlife"))
        th.msleep(500)
        th.lineEditTypewrite("5",
                             tool.body.currentWidget().ui.toolcurrentlifez)
Ejemplo n.º 5
0
 def tearDown(self):
     th.close(self.tool)
Ejemplo n.º 6
0
 def tearDown(self):
     th.close(self.homewindow)
     # 恢复XYZ寻原点方向初始值
     for i in range(basic.axisCount()):
         P[1701 + i] = self.origin_dir[i]
Ejemplo n.º 7
0
 def tearDown(self):
     th.close(self.win)
Ejemplo n.º 8
0
 def test_forbidden_halt(self):
     P[4142] = 1
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "其他功能")
     th.msleep(1000)
     # self.win = th.assertActiveWindow(basic.otherDialog)
     # 登录操作员
     self.win = QtWidgets.QApplication.activeWindow()
     if self.win.windowTitle() == "其他功能":
         th.clickButton(self.win, "用户管理")
         self.win = th.assertActiveWindow(basic.UserManagementDialog)
         th.clickButton(self.win, "操作员登录")
     th.msleep(500)
     th.close(self.win)
     th.msleep(1000)
     assert basic.Auth_Level() == 20
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(5000)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "暂停")
     win = QtWidgets.QApplication.activeWindow()
     assert win.windowTitle() == "用户登录"
     th.msleep(1000)
     # 输入技术员密码,登录技术员
     th.typewrite("051280988566")
     th.msleep(500)
     th.press('enter')
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "暂停")
     th.msleep(500)
     # 判断为进给保持状态
     assert F[1]
     th.clickButton(basic.mainWindow, "F12 停止")
     th.msleep(1000)
     # 判断为准备好状态
     assert F[3]
     # 再次登录操作员
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "其他功能")
     self.win = QtWidgets.QApplication.activeWindow()
     if self.win.windowTitle() == "其他功能":
         th.clickButton(self.win, "用户管理")
         self.win = th.assertActiveWindow(basic.UserManagementDialog)
         th.clickButton(self.win, "操作员登录")
     th.msleep(500)
     th.close(self.win)
     assert basic.Auth_Level() == 20
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(5000)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F12 停止")
     win = QtWidgets.QApplication.activeWindow()
     assert win.windowTitle() == "用户登录"
     th.msleep(1000)
     th.typewrite("051280988566")
     th.msleep(500)
     th.press('enter')
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F12 停止")
     th.msleep(1000)
     # 判断为准备好状态
     assert F[3]
     P[4142] = 0
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "其他功能")
     self.win = QtWidgets.QApplication.activeWindow()
     if self.win.windowTitle() == "其他功能":
         th.clickButton(self.win, "用户管理")
         self.win = th.assertActiveWindow(basic.UserManagementDialog)
         th.clickButton(self.win, "操作员登录")
     th.msleep(500)
     th.close(self.win)
     th.msleep(1000)
     assert basic.Auth_Level() == 20
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(5000)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "暂停")
     th.msleep(1000)
     # 判断为进给保持状态
     assert F[1]
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F11开始")
     th.msleep(3000)
     th.assertActiveWindow(basic.mainWindow)
     th.clickButton(basic.mainWindow, "F12 停止")
     th.msleep(1000)
     # 判断为准备好状态
     assert F[3]