コード例 #1
0
ファイル: test_markers.py プロジェクト: alexlib/enable
    def test_get_compiled_path(self):
        path = CompiledPath()
        path.begin_path()
        path.move_to(-5, -5)
        path.line_to(-5, 5)
        path.line_to(5, 5)
        path.line_to(5, -5)
        path.line_to(-5, -5)

        marker = CustomMarker(path=path)

        # should not fail
        marker.get_compiled_path(np.int64(0))
コード例 #2
0
ファイル: test_markers.py プロジェクト: alexlib/enable
    def test_add_to_path(self):
        path = CompiledPath()
        path.begin_path()
        path.move_to(-5, -5)
        path.line_to(-5, 5)
        path.line_to(5, 5)
        path.line_to(5, -5)
        path.line_to(-5, -5)

        marker = CustomMarker(path=path)

        gc = GraphicsContext((50, 50))
        # should not fail
        marker.add_to_path(gc.get_empty_path(), np.int64(0))
コード例 #3
0
ファイル: scatter_custom_marker.py プロジェクト: 5n1p/chaco
def make_custom_marker():
    path = CompiledPath()
    path.move_to(-5,-5)
    path.line_to(5, 5)
    path.line_to(5, -5)
    path.line_to(-5, 5)
    path.line_to(-5, -5)
    return path
コード例 #4
0
def make_custom_marker():
    path = CompiledPath()
    path.move_to(-5, -5)
    path.line_to(5, 5)
    path.line_to(5, -5)
    path.line_to(-5, 5)
    path.line_to(-5, -5)
    return path
コード例 #5
0
    def test_scatter_custom(self):
        """ Coverage test to check custom markers work...

        XXX ...which apparently they currently don't. See #232.
        """

        # build path
        path = CompiledPath()
        path.begin_path()
        path.move_to(-5, -5)
        path.line_to(-5, 5)
        path.line_to(5, 5)
        path.line_to(5, -5)
        path.line_to(-5, -5)

        self.scatterplot.marker = 'custom'
        self.scatterplot.custom_symbol = path

        self.gc.render_component(self.scatterplot)
        actual = self.gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
コード例 #6
0
    def test_scatter_custom(self):
        """ Coverage test to check custom markers work...

        XXX ...which apparently they currently don't. See #232.
        """

        # build path
        path = CompiledPath()
        path.begin_path()
        path.move_to(-5, -5)
        path.line_to(-5, 5)
        path.line_to(5, 5)
        path.line_to(5, -5)
        path.line_to(-5, -5)

        self.scatterplot.marker = 'custom'
        self.scatterplot.custom_symbol = path

        self.gc.render_component(self.scatterplot)
        actual = self.gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
コード例 #7
0
    def test_scatter_1d_custom(self):
        path = CompiledPath()
        path.move_to(-5, -5)
        path.line_to(5, 5)
        path.line_to(5, -5)
        path.line_to(-5, 5)
        path.line_to(-5, -5)

        self.scatterplot.marker = 'custom'
        self.scatterplot.custom_symbol = path
        gc = PlotGraphicsContext(self.size)
        gc.render_component(self.scatterplot)
        actual = gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
コード例 #8
0
    def test_scatter_1d_custom(self):
        path = CompiledPath()
        path.move_to(-5, -5)
        path.line_to(5, 5)
        path.line_to(5, -5)
        path.line_to(-5, 5)
        path.line_to(-5, -5)

        self.scatterplot.marker = 'custom'
        self.scatterplot.custom_symbol = path
        gc = PlotGraphicsContext(self.size)
        gc.render_component(self.scatterplot)
        actual = gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))
コード例 #9
0
    def test_scatter_custom(self):
        """ Coverage test to check custom markers work """
        # build path
        path = CompiledPath()
        path.move_to(-5, -5)
        path.line_to(5, 5)
        path.line_to(5, -5)
        path.line_to(-5, 5)
        path.line_to(-5, -5)

        size = (50, 50)
        scatterplot = create_scatter_plot(
            data=[range(10), range(10)],
            marker='custom',
            border_visible=False,
        )
        scatterplot.custom_symbol = path
        scatterplot.outer_bounds = list(size)
        gc = PlotGraphicsContext(size)
        gc.render_component(scatterplot)
        actual = gc.bmp_array[:, :, :]
        self.assertFalse(alltrue(actual == 255))