1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
import unittest
import sys
from pyqtlet2 import L, MapWidget
from qtpy.QtCore import Slot, Signal, QJsonValue
from qtpy.QtWidgets import QApplication
app = QApplication(sys.argv)
class LayerTestCase(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.mapWidget = MapWidget()
cls.map = L.map(cls.mapWidget)
cls.initial_latlng = (0, 0)
cls.new_latlng = (1, 1)
cls.initial_layer_latlngs = [(0, 0), (1, 1)]
def test_marker(self):
test_marker = L.marker(self.initial_latlng, options={"draggable": False})
test_marker.setLatLng(self.new_latlng)
self.assertEqual(test_marker.latLng, self.new_latlng)
self.assertFalse(test_marker.draggable)
test_marker.setDragging(True)
self.assertTrue(test_marker.draggable)
def test_polyline(self):
test_polyline = L.polyline(self.initial_layer_latlngs, options=None)
self.assertEqual(test_polyline.latLngs, self.initial_layer_latlngs)
if __name__ == '__main__':
unittest.main()
|