コード例 #1
0
ファイル: testsuite.py プロジェクト: dericke/gottengeography
 def test_gsettings(self):
     """Make sure that GSettings is storing data correctly."""
     app.gst.reset('history')
     self.assertEqual(gst_get('history')[0], (34.5, 15.8, 2))
     map_view.center_on(12.3, 45.6)
     self.assertEqual(app.gst.get_double('latitude'), 12.3)
     self.assertEqual(app.gst.get_double('longitude'), 45.6)
     map_view.zoom_in()
     map_view.emit('realize')
     self.assertEqual(list(gst_get('history')),
                      [(34.5, 15.8, 2), (12.3, 45.6, 3)])
     map_view.set_map_source(MAP_SOURCES['osm-cyclemap'])
     self.assertEqual(app.gst.get_string('map-source-id'), 'osm-cyclemap')
コード例 #2
0
ファイル: testsuite.py プロジェクト: kriestof/gottengeography
 def test_gsettings(self):
     """Make sure that GSettings is storing data correctly."""
     app.gst.reset('history')
     self.assertEqual(gst_get('history')[0], (34.5, 15.8, 2))
     map_view.center_on(12.3, 45.6)
     self.assertEqual(app.gst.get_double('latitude'), 12.3)
     self.assertEqual(app.gst.get_double('longitude'), 45.6)
     map_view.zoom_in()
     map_view.emit('realize')
     self.assertEqual(list(gst_get('history')),
                      [(34.5, 15.8, 2), (12.3, 45.6, 3)])
     map_view.set_map_source(MAP_SOURCES['osm-cyclemap'])
     self.assertEqual(app.gst.get_string('map-source-id'), 'osm-cyclemap')
コード例 #3
0
ファイル: testsuite.py プロジェクト: kriestof/gottengeography
 def test_actor_controller(self):
     """Make sure the actors are behaving."""
     link = get_obj('maps_link')
     map_view.center_on(50, 50)
     self.assertEqual(gui.actors.label.get_text(), 'N 50.00000, E 50.00000')
     self.assertEqual(link.get_uri()[:49],
         'http://maps.google.com/maps?ll=50.0,50.0&spn=')
     map_view.center_on(-10, -30)
     self.assertEqual(gui.actors.label.get_text(), 'S 10.00000, W 30.00000')
     self.assertEqual(link.get_uri()[:51],
         'http://maps.google.com/maps?ll=-10.0,-30.0&spn=')
     for rot in gui.actors.xhair.get_rotation(Clutter.RotateAxis.Z_AXIS):
         self.assertEqual(rot, 0)
     gui.actors.animate_in(10)
     self.assertEqual(gui.actors.xhair.get_rotation(Clutter.RotateAxis.Z_AXIS)[0], 45)
     self.assertEqual(gui.actors.black.get_width(), map_view.get_width())
コード例 #4
0
ファイル: testsuite.py プロジェクト: dericke/gottengeography
 def test_actor_controller(self):
     """Make sure the actors are behaving."""
     from actor import ActorController
     control = ActorController()
     link = get_obj('maps_link')
     map_view.center_on(50, 50)
     self.assertEqual(control.label.get_text(), 'N 50.00000, E 50.00000')
     self.assertEqual(link.get_current_uri()[:45],
         'http://maps.google.com/maps?ll=50.0,50.0&spn=')
     map_view.center_on(-10, -30)
     self.assertEqual(control.label.get_text(), 'S 10.00000, W 30.00000')
     self.assertEqual(link.get_current_uri()[:47],
         'http://maps.google.com/maps?ll=-10.0,-30.0&spn=')
     for rot in control.xhair.get_rotation(Clutter.RotateAxis.Z_AXIS):
         self.assertEqual(rot, 0)
     control.animate_in(10)
     self.assertEqual(control.xhair.get_rotation(Clutter.RotateAxis.Z_AXIS)[0], 45)
     self.assertEqual(control.xhair.get_size(), (8, 9))
     self.assertEqual(control.black.get_width(), map_view.get_width())
コード例 #5
0
ファイル: testsuite.py プロジェクト: marcoil/gottengeography
 def test_actor_controller(self):
     """Make sure the actors are behaving."""
     from actor import ActorController
     control = ActorController()
     link = get_obj('maps_link')
     map_view.center_on(50, 50)
     self.assertEqual(control.label.get_text(), 'N 50.00000, E 50.00000')
     self.assertEqual(link.get_current_uri()[:45],
         'http://maps.google.com/maps?ll=50.0,50.0&spn=')
     map_view.center_on(-10, -30)
     self.assertEqual(control.label.get_text(), 'S 10.00000, W 30.00000')
     self.assertEqual(link.get_current_uri()[:47],
         'http://maps.google.com/maps?ll=-10.0,-30.0&spn=')
     for rot in control.xhair.get_rotation(Clutter.RotateAxis.Z_AXIS):
         self.assertEqual(rot, 0)
     control.animate_in(10)
     self.assertEqual(control.xhair.get_rotation(Clutter.RotateAxis.Z_AXIS)[0], 45)
     self.assertEqual(control.xhair.get_size(), (8, 9))
     self.assertEqual(control.black.get_width(), map_view.get_width())
コード例 #6
0
ファイル: testsuite.py プロジェクト: dericke/gottengeography
 def test_navigation_controller(self):
     """Ensure that it's possible to navigate the map."""
     coords = [[
         map_view.get_property('latitude'),
         map_view.get_property('longitude')
     ]]
     map_view.emit('realize')
     map_view.emit('animation-completed')
     self.assertGreater(len(get_obj('main').get_title()[18:]), 5)
     
     lat = round(random_coord(90),  6)
     lon = round(random_coord(180), 6)
     map_view.center_on(lat, lon)
     coords.append([lat, lon])
     
     self.assertAlmostEqual(coords[0][0], gst_get('history')[-1][0], 5)
     self.assertAlmostEqual(coords[0][1], gst_get('history')[-1][1], 5)
     
     lat = round(random_coord(80),  6)
     lon = round(random_coord(170), 6)
     map_view.center_on(lat, lon)
     
     zoom_in  = get_obj('zoom_in_button')
     zoom_out = get_obj('zoom_out_button')
     map_view.set_zoom_level(0)
     self.assertFalse(zoom_out.get_sensitive())
     self.assertTrue(zoom_in.get_sensitive())
     zoom_in.emit('clicked')
     self.assertTrue(zoom_out.get_sensitive())
     self.assertTrue(zoom_in.get_sensitive())
     self.assertEqual(1, map_view.get_zoom_level())
     zoom_in.emit('clicked')
     self.assertEqual(2, map_view.get_zoom_level())
     zoom_in.emit('clicked')
     self.assertEqual(3, map_view.get_zoom_level())
     zoom_out.emit('clicked')
     self.assertEqual(2, map_view.get_zoom_level())
     map_view.set_zoom_level(map_view.get_max_zoom_level()-1)
     self.assertTrue(zoom_out.get_sensitive())
     self.assertTrue(zoom_in.get_sensitive())
     zoom = map_view.get_zoom_level()
     zoom_in.emit('clicked')
     self.assertTrue(zoom_out.get_sensitive())
     self.assertFalse(zoom_in.get_sensitive())
     self.assertEqual(map_view.get_max_zoom_level(),
         map_view.get_zoom_level())
     
     get_obj("back_button").emit('clicked')
     
     map_view.set_zoom_level(5)
     
     lat = map_view.get_property('latitude')
     lon = map_view.get_property('longitude')
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Left"), None)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 4)
     self.assertGreater(    lon, map_view.get_property('longitude'))
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Right"), None)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 4)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 0)
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Right"), None)
     self.assertLess(       lon, map_view.get_property('longitude'))
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 4)
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Left"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 0)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 4)
     
     lon = map_view.get_property('longitude')
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Up"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 4)
     self.assertLess(       lat, map_view.get_property('latitude'))
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Down"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 4)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 0)
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Down"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 4)
     self.assertGreater(    lat, map_view.get_property('latitude'))
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Up"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 4)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 0)
コード例 #7
0
ファイル: app.py プロジェクト: kriestof/gottengeography
 def jump_to_photo(self, button):
     """Center on the first selected photo."""
     photo = selected.copy().pop()
     if photo.valid_coords():
         map_view.emit('realize')
         map_view.center_on(photo.latitude, photo.longitude)
コード例 #8
0
ファイル: testsuite.py プロジェクト: kriestof/gottengeography
 def test_navigation_controller(self):
     """Ensure that it's possible to navigate the map."""
     coords = [[
         map_view.get_property('latitude'),
         map_view.get_property('longitude')
     ]]
     map_view.emit('realize')
     map_view.emit('animation-completed')
     self.assertGreater(len(get_obj('main').get_title()[18:]), 5)
     
     lat = round(random_coord(90),  6)
     lon = round(random_coord(180), 6)
     map_view.center_on(lat, lon)
     coords.append([lat, lon])
     
     self.assertAlmostEqual(coords[0][0], gst_get('history')[-1][0], 5)
     self.assertAlmostEqual(coords[0][1], gst_get('history')[-1][1], 5)
     
     lat = round(random_coord(80),  6)
     lon = round(random_coord(170), 6)
     map_view.center_on(lat, lon)
     
     zoom_in  = get_obj('zoom_in_button')
     zoom_out = get_obj('zoom_out_button')
     map_view.set_zoom_level(0)
     self.assertFalse(zoom_out.get_sensitive())
     self.assertTrue(zoom_in.get_sensitive())
     zoom_in.emit('clicked')
     self.assertTrue(zoom_out.get_sensitive())
     self.assertTrue(zoom_in.get_sensitive())
     self.assertEqual(1, map_view.get_zoom_level())
     zoom_in.emit('clicked')
     self.assertEqual(2, map_view.get_zoom_level())
     zoom_in.emit('clicked')
     self.assertEqual(3, map_view.get_zoom_level())
     zoom_out.emit('clicked')
     self.assertEqual(2, map_view.get_zoom_level())
     map_view.set_zoom_level(map_view.get_max_zoom_level()-1)
     self.assertTrue(zoom_out.get_sensitive())
     self.assertTrue(zoom_in.get_sensitive())
     zoom = map_view.get_zoom_level()
     zoom_in.emit('clicked')
     self.assertTrue(zoom_out.get_sensitive())
     self.assertFalse(zoom_in.get_sensitive())
     self.assertEqual(map_view.get_max_zoom_level(),
         map_view.get_zoom_level())
     
     get_obj("back_button").emit('clicked')
     
     map_view.set_zoom_level(5)
     
     lat = map_view.get_property('latitude')
     lon = map_view.get_property('longitude')
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Left"), None)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 4)
     self.assertGreater(    lon, map_view.get_property('longitude'))
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Right"), None)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 4)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 0)
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Right"), None)
     self.assertLess(       lon, map_view.get_property('longitude'))
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 4)
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Left"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 0)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 4)
     
     lon = map_view.get_property('longitude')
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Up"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 4)
     self.assertLess(       lat, map_view.get_property('latitude'))
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Down"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 4)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 0)
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Down"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 4)
     self.assertGreater(    lat, map_view.get_property('latitude'))
     
     move_by_arrow_keys(None, None, Gdk.keyval_from_name("Up"), None)
     self.assertAlmostEqual(lon, map_view.get_property('longitude'), 4)
     self.assertAlmostEqual(lat, map_view.get_property('latitude'), 0)