示例#1
0
    def test_plot_clear(self):
        # tests to make sure that when the clear flag is passed
        # to plots, that clear works as expected
        plot_item = MyPlotItem()
        x = [1]
        y = [1]
        plot = PlotCurveItem(x, y)
        plot_item.addItem(plot)

        plot2 = PlotCurveItem(y, x)
        plot_item.add_event_item(plot2)

        plot5 = PlotCurveItem(y, x)
        plot_item.addItem(plot5)

        x = y = np.zeros(2)
        plot3 = PathItem(x, y)
        plot_item.add_event_item(plot3)

        plot4 = plot_item.plot(clear=True)

        # Test that all of the plots have been cleared,
        # and that plot4 was added successfully
        self.assertEqual(len(plot_item.listDataItems()), 1)
        self.assertEqual(len(plot_item._myEventItemList), 0)
        self.assertEqual(len(plot_item._myItemList), 1)
        self.assertEqual(plot_item.listDataItems()[0], plot4)
        self.assertEqual(plot_item._myItemList[0], plot4)
示例#2
0
    def test_plot_clear(self):
        # tests to make sure that when the clear flag is passed
        # to plots, that clear works as expected
        plot_item = MyPlotItem()
        x = [1]
        y = [1]
        plot = PlotCurveItem(x, y)
        plot_item.addItem(plot)

        plot2 = PlotCurveItem(y, x)
        plot_item.add_event_item(plot2)

        plot5 = PlotCurveItem(y, x)
        plot_item.addItem(plot5)

        x = y = np.zeros(2)
        plot3 = PathItem(x, y)
        plot_item.add_event_item(plot3)

        plot4 = plot_item.plot(clear=True)

        # Test that all of the plots have been cleared,
        # and that plot4 was added successfully
        self.assertEqual(len(plot_item.listDataItems()), 1)
        self.assertEqual(len(plot_item._myEventItemList), 0)
        self.assertEqual(len(plot_item._myItemList), 1)
        self.assertEqual(plot_item.listDataItems()[0], plot4)
        self.assertEqual(plot_item._myItemList[0], plot4)
示例#3
0
    def test_add_event_item(self):
        plot_item = MyPlotItem()
        x = [1]
        y = [1]
        plot = PlotCurveItem(x, y)
        plot_item.add_event_item(plot)

        self.assertEqual(len(plot_item._myEventItemList), 1)

        x = y = np.zeros(2)
        plot2 = PathItem(x, y)
        plot_item.add_event_item(plot2)
        self.assertEqual(len(plot_item._myEventItemList), 2)
示例#4
0
    def test_add_event_item(self):
        plot_item = MyPlotItem()
        x = [1]
        y = [1]
        plot = PlotCurveItem(x, y)
        plot_item.add_event_item(plot)

        self.assertEqual(len(plot_item._myEventItemList), 1)

        x = y = np.zeros(2)
        plot2 = PathItem(x, y)
        plot_item.add_event_item(plot2)
        self.assertEqual(len(plot_item._myEventItemList), 2)
示例#5
0
    def test_clear_event_items(self):
        plot_item = MyPlotItem()
        x = [1]
        y = [1]
        plot = PlotCurveItem(x, y)
        plot_item.addItem(plot)

        plot2 = PlotCurveItem(y, x)
        plot_item.add_event_item(plot2)

        self.assertEqual(len(plot_item._myEventItemList), 1)
        self.assertEqual(len(plot_item.listDataItems()), 2)

        plot_item.clear_event_items()
        self.assertEqual(len(plot_item._myEventItemList), 0)

        self.assertEqual(len(plot_item.listDataItems()), 1)
示例#6
0
    def test_clear_event_items(self):
        plot_item = MyPlotItem()
        x = [1]
        y = [1]
        plot = PlotCurveItem(x, y)
        plot_item.addItem(plot)

        plot2 = PlotCurveItem(y, x)
        plot_item.add_event_item(plot2)

        self.assertEqual(len(plot_item._myEventItemList), 1)
        self.assertEqual(len(plot_item.listDataItems()), 2)

        plot_item.clear_event_items()
        self.assertEqual(len(plot_item._myEventItemList), 0)

        self.assertEqual(len(plot_item.listDataItems()), 1)
示例#7
0
    def test_clear(self):
        plot_item = MyPlotItem()
        x = [1]
        y = [1]
        plot = PlotCurveItem(x, y)
        plot_item.addItem(plot)

        plot2 = PlotCurveItem(y, x)
        plot_item.add_event_item(plot2)

        x = y = np.zeros(2)
        plot3 = PathItem(x, y)
        plot_item.add_event_item(plot3)

        plot_item.clear()
        self.assertEqual(len(plot_item.listDataItems()), 0)
        self.assertEqual(len(plot_item._myEventItemList), 0)
        self.assertEqual(len(plot_item._myItemList), 0)
示例#8
0
    def test_clear(self):
        plot_item = MyPlotItem()
        x = [1]
        y = [1]
        plot = PlotCurveItem(x, y)
        plot_item.addItem(plot)

        plot2 = PlotCurveItem(y, x)
        plot_item.add_event_item(plot2)

        x = y = np.zeros(2)
        plot3 = PathItem(x, y)
        plot_item.add_event_item(plot3)

        plot_item.clear()
        self.assertEqual(len(plot_item.listDataItems()), 0)
        self.assertEqual(len(plot_item._myEventItemList), 0)
        self.assertEqual(len(plot_item._myItemList), 0)