Exemplo n.º 1
0
def test_gotocenter_01():
    p = instantiate_virtual_plotter()
    p.goto_center()
    assert p._serial_port._received_commands_string == 'IN;PA5160.00,3960.00;'
    assert p._serial_port.get_received_commands() == [
        IN(), PA([(5160.0, 3960.0)])
    ]
Exemplo n.º 2
0
def test_set_plot_window_01():
    '''Arguments as tuples.'''
    p = instantiate_virtual_plotter()
    p.set_plot_window((0, 0), (1, 2))
Exemplo n.º 3
0
def test_plotter_write_01( ):
    '''write( ) can take a string of raw HPGL commands.'''
    p = instantiate_virtual_plotter( )
    commands = 'SP1;PA0,0;PD;PU;'
    p.write(commands)
    assert p.format == 'IN;' + commands
Exemplo n.º 4
0
def test_plotter_write_03( ):
    '''write( ) can take list/tuple of string HPGL commands.'''
    p = instantiate_virtual_plotter( )
    commands = ['SP2;', 'PA0,0;', 'PD;', 'PU;']
    p.write(commands)
    assert p.format == 'IN;' + ''.join(commands)
Exemplo n.º 5
0
def test_marginsoft_01( ):
    '''plotter.margins.soft is an instance of MarginsSoft.'''
    p = instantiate_virtual_plotter( )
    m = p.margins.soft
    assert isinstance(m, MarginsSoft)
Exemplo n.º 6
0
def test_plotter_write_03():
    '''write( ) can take list/tuple of string HPGL commands.'''
    p = instantiate_virtual_plotter()
    commands = ['SP2;', 'PA0,0;', 'PD;', 'PU;']
    p.write(commands)
    assert p.format == 'IN;' + ''.join(commands)
Exemplo n.º 7
0
def test_set_origin_center():
    p = instantiate_virtual_plotter()
    p.set_origin_center()
Exemplo n.º 8
0
def test_nudge():
    p = instantiate_virtual_plotter()
    p.nudge(1, 2)
Exemplo n.º 9
0
def test_set_origin_bottom_left():
    p = instantiate_virtual_plotter( )
    p.set_origin_bottom_left()
Exemplo n.º 10
0
def test_nudge():
    p = instantiate_virtual_plotter( )
    p.nudge(1, 2)
Exemplo n.º 11
0
def test_goto_top_right():
    p = instantiate_virtual_plotter( )
    p.goto_top_right()
Exemplo n.º 12
0
def test_goto_origin():
    p = instantiate_virtual_plotter( )
    p.goto_origin()
Exemplo n.º 13
0
def test_goto_bottom_left():
    p = instantiate_virtual_plotter( )
    p.goto_bottom_left()
Exemplo n.º 14
0
def test_gotocenter_01():
    p = instantiate_virtual_plotter( )
    p.goto_center()
    assert p._serial_port._received_commands_string == 'IN;PA5160.00,3960.00;'
    assert p._serial_port.get_received_commands() == [IN(), PA([(5160.0,3960.0)])]
Exemplo n.º 15
0
def test_plotter_write_01():
    '''write( ) can take a string of raw HPGL commands.'''
    p = instantiate_virtual_plotter()
    commands = 'SP1;PA0,0;PD;PU;'
    p.write(commands)
    assert p.format == 'IN;' + commands
Exemplo n.º 16
0
def test_set_origin_top_right():
    p = instantiate_virtual_plotter( )
    p.set_origin_top_right()
Exemplo n.º 17
0
def test_goto_origin():
    p = instantiate_virtual_plotter()
    p.goto_origin()
Exemplo n.º 18
0
def test_set_origin_center():
    p = instantiate_virtual_plotter( )
    p.set_origin_center()
Exemplo n.º 19
0
def test_set_origin_top_right():
    p = instantiate_virtual_plotter()
    p.set_origin_top_right()
Exemplo n.º 20
0
def test_set_origin_current_location():
    p = instantiate_virtual_plotter()
    p.set_origin_current_location()
Exemplo n.º 21
0
def test_set_origin_to_point():
    p = instantiate_virtual_plotter()
    p.set_origin_to_point(Coordinate(1, 2))
Exemplo n.º 22
0
def test_goto_01():
    p = instantiate_virtual_plotter( )
    p.goto(10, 10)
    assert p._serial_port.get_received_commands() == [IN(), PA([(10, 10)])]
Exemplo n.º 23
0
def test_marginsoft_03( ):
    '''MarginsSoft.top_right returns a Coordinate.'''
    p = instantiate_virtual_plotter( )
    m = p.margins.soft.top_right
    assert isinstance(m, Coordinate)
Exemplo n.º 24
0
def test_set_origin_to_point():
    p = instantiate_virtual_plotter()
    p.set_origin_to_point(Coordinate(1, 2))
Exemplo n.º 25
0
def test_plotter_write_02( ):
    '''write( ) can take a Chiplotle HPGL command.'''
    p = instantiate_virtual_plotter( )
    command = CI(1000)
    p.write(command)
    assert p.format == 'IN;' + command.format
Exemplo n.º 26
0
def test_rotate():
    p = instantiate_virtual_plotter()
    p.rotate(90)
Exemplo n.º 27
0
def test_plotter_write_04( ):
    '''write( ) can take list/tuple of Chiplotle HPGL commands.'''
    p = instantiate_virtual_plotter( )
    commands = [PA([(1000, 0)]), CI(500)]
    p.write(commands)
    assert p.format == 'IN;' + ''.join([c.format for c in commands])
Exemplo n.º 28
0
def test_scale():
    p = instantiate_virtual_plotter()
    p.scale(0, 0, 2, 2)
Exemplo n.º 29
0
def test_scale():
    p = instantiate_virtual_plotter()
    p.scale(0, 0, 2, 2)
Exemplo n.º 30
0
def test_set_plot_window_01():
    '''Arguments as tuples.'''
    p = instantiate_virtual_plotter()
    p.set_plot_window((0, 0), (1, 2))
Exemplo n.º 31
0
def test_set_plot_window_02():
    '''Arguments as coordinates.'''
    p = instantiate_virtual_plotter()
    p.set_plot_window(Coordinate(0, 0), Coordinate(1, 2))
Exemplo n.º 32
0
def test_set_plot_window_02():
    '''Arguments as coordinates.'''
    p = instantiate_virtual_plotter()
    p.set_plot_window(Coordinate(0, 0), Coordinate(1, 2))
Exemplo n.º 33
0
def test_goto_bottom_left():
    p = instantiate_virtual_plotter()
    p.goto_bottom_left()
Exemplo n.º 34
0
def test_plotter_write_01():
    """write( ) can take a string of raw HPGL commands."""
    p = instantiate_virtual_plotter()
    commands = b"SP1;PA0,0;PD;PU;"
    p.write(commands)
    assert p.format == b"IN;" + commands
Exemplo n.º 35
0
def test_goto_top_right():
    p = instantiate_virtual_plotter()
    p.goto_top_right()
Exemplo n.º 36
0
def test_plotter_write_02():
    """write( ) can take a Chiplotle HPGL command."""
    p = instantiate_virtual_plotter()
    command = CI(1000)
    p.write(command)
    assert p.format == b"IN;" + command.format
Exemplo n.º 37
0
def test_set_origin_bottom_left():
    p = instantiate_virtual_plotter()
    p.set_origin_bottom_left()
Exemplo n.º 38
0
def test_plotter_write_03():
    """write( ) can take list/tuple of string HPGL commands."""
    p = instantiate_virtual_plotter()
    commands = [b"SP2;", b"PA0,0;", b"PD;", b"PU;"]
    p.write(commands)
    assert p.format == b"IN;" + b"".join(commands)
Exemplo n.º 39
0
def test_goto_01():
    p = instantiate_virtual_plotter()
    p.goto(10, 10)
    assert p._serial_port.get_received_commands() == [IN(), PA([(10, 10)])]
Exemplo n.º 40
0
def test_plotter_write_04():
    """write( ) can take list/tuple of Chiplotle HPGL commands."""
    p = instantiate_virtual_plotter()
    commands = [PA([(1000, 0)]), CI(500)]
    p.write(commands)
    assert p.format == b"IN;" + b"".join([c.format for c in commands])
Exemplo n.º 41
0
def test_set_origin_current_location():
    p = instantiate_virtual_plotter()
    p.set_origin_current_location()
Exemplo n.º 42
0
def test_marginsoft_02( ):
    '''MarginsSoft.bottom_left returns a Coordinate.'''
    p = instantiate_virtual_plotter( )
    m = p.margins.soft.bottom_left
    assert isinstance(m, Coordinate)
Exemplo n.º 43
0
def test_rotate():
    p = instantiate_virtual_plotter()
    p.rotate(90)
Exemplo n.º 44
0
def test_plotter_write_02():
    '''write( ) can take a Chiplotle HPGL command.'''
    p = instantiate_virtual_plotter()
    command = CI(1000)
    p.write(command)
    assert p.format == 'IN;' + command.format