コード例 #1
0
def test_map_sources():
    """The map should have multiple sources"""
    MapView.set_map_source(MAP_SOURCES['osm-cyclemap'])
    assert Gst.get_string('map-source-id') == 'osm-cyclemap'

    Gst.set_string('map-source-id', 'mff-relief')
    assert MapView.get_map_source().get_id() == 'mff-relief'

    menu = Widgets.map_source_menu.get_active().get_group()
    assert menu
    for menu_item in menu:
        menu_item.set_active(True)
        assert MapView.get_map_source().get_name() == menu_item.get_label()
コード例 #2
0
def test_history():
    """The history should keep track of where we go"""
    coords = [[MapView.get_center_latitude(), MapView.get_center_longitude()]]
    MapView.emit('realize')
    assert len(Widgets.main.get_title()) > 5
    assert Widgets.main.get_title().index(',') > 0

    lat = random_coord(90)
    lon = random_coord(180)
    MapView.center_on(lat, lon)
    coords.append([lat, lon])

    assert coords[0][0] - Gst.get('history')[-1][0] < 1e-6
    assert coords[0][1] - Gst.get('history')[-1][1] < 1e-6
コード例 #3
0
def test_history():
    """The history should keep track of where we go"""
    coords = [[
        MapView.get_center_latitude(),
        MapView.get_center_longitude()
    ]]
    MapView.emit('realize')
    assert len(Widgets.main.get_title()) > 5
    assert Widgets.main.get_title().index(',') > 0

    lat = random_coord(90)
    lon = random_coord(180)
    MapView.center_on(lat, lon)
    coords.append([lat, lon])

    assert coords[0][0] - Gst.get('history')[-1][0] < 1e-6
    assert coords[0][1] - Gst.get('history')[-1][1] < 1e-6
コード例 #4
0
def test_gsettings():
    """GSettings should be storing data correctly"""
    Gst.reset('history')
    assert Gst.get('history')[0] == (34.5, 15.8, 2)

    MapView.set_zoom_level(2)
    MapView.center_on(12.3, 45.6)
    assert Gst.get_double('latitude') == 12.3
    assert Gst.get_double('longitude') == 45.6

    MapView.zoom_in()
    MapView.emit('realize')
    assert list(Gst.get('history')) == [(34.5, 15.8, 2), (12.3, 45.6, 3)]
コード例 #5
0
def test_gsettings():
    """GSettings should be storing data correctly"""
    Gst.reset("history")
    assert Gst.get("history")[0] == (34.5, 15.8, 2)

    MapView.set_zoom_level(2)
    MapView.center_on(12.3, 45.6)
    assert Gst.get_double("latitude") == 12.3
    assert Gst.get_double("longitude") == 45.6

    MapView.zoom_in()
    MapView.emit("realize")
    assert list(Gst.get("history")) == [(34.5, 15.8, 2), (12.3, 45.6, 3)]