File: test_layer_elements.py

package info (click to toggle)
python-pyqtlet2 0.9.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,672 kB
  • sloc: python: 997; javascript: 88; makefile: 18; sh: 14
file content (36 lines) | stat: -rw-r--r-- 1,055 bytes parent folder | download
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()