示例#1
0
        class TestLinkItem(unittest.TestCase):
            def setUp(self):
                self.view = QGraphicsView()
                self.scene = QGraphicsScene()
                self.scene.setSceneRect(-150, -105, 300, 210)
                self.scene.addRect(-150, -105, 300 - 1, 210 - 1, QPen(Qt.black))
                self.view.setScene(self.scene)

            def tearDown(self):
                self.view.show()

                process_events_with_timeout(timeout)

                self.li.terminate()
                self.ri1._stop_networking() # TODO
                self.ri2._stop_networking() # TODO

            def test_main(self):
                self.ri1 = RouterItem(1)
                self.ri2 = RouterItem(2)
                
                self.scene.addItem(self.ri1)
                self.scene.addItem(self.ri2)

                self.ri1.setPos(-100, -50)
                self.ri2.setPos(100, 50)

                self.li = LinkItem(self.ri1, self.ri2, enabled=True)
                self.scene.addItem(self.li)

                self.finished = True

            def test_image_transfer(self):
                self.ri1 = SendImageRouterItem(0, 1)
                self.ri2 = ReceiveImageRouterItem(1)

                self.scene.addItem(self.ri1)
                self.scene.addItem(self.ri2)

                self.ri1.setPos(-100, -50)
                self.ri2.setPos(100, 50)

                self.li = LinkItem(self.ri1, self.ri2, enabled=True)
                self.scene.addItem(self.li)

                self.ri1.send_data(range(100))

                self.finished = True
示例#2
0
            def test_main(self):
                self.ri1 = RouterItem(1)
                self.ri2 = RouterItem(2)
                
                self.scene.addItem(self.ri1)
                self.scene.addItem(self.ri2)

                self.ri1.setPos(-100, -50)
                self.ri2.setPos(100, 50)

                self.li = LinkItem(self.ri1, self.ri2, enabled=True)
                self.scene.addItem(self.li)

                self.finished = True
示例#3
0
            def test_image_transfer(self):
                self.ri1 = SendImageRouterItem(0, 1)
                self.ri2 = ReceiveImageRouterItem(1)

                self.scene.addItem(self.ri1)
                self.scene.addItem(self.ri2)

                self.ri1.setPos(-100, -50)
                self.ri2.setPos(100, 50)

                self.li = LinkItem(self.ri1, self.ri2, enabled=True)
                self.scene.addItem(self.li)

                self.ri1.send_data(range(100))

                self.finished = True