summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorQuentinAndre <quentin.andre@imt-atlantique.net>2021-08-13 22:32:55 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-10-25 12:06:02 +0200
commit6772ecdf2e5911e3a5c5ddde7e5b5ef42d17fecd (patch)
treec697f1ec6c614f830353e048d6571c78c8e824c5 /ishtar_common
parent5124549dd86b3a4522cc953768a93e4dcce1a89c (diff)
downloadIshtar-6772ecdf2e5911e3a5c5ddde7e5b5ef42d17fecd.tar.bz2
Ishtar-6772ecdf2e5911e3a5c5ddde7e5b5ef42d17fecd.zip
version before checkbutton
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/static/js/ishtar-map.js2
-rw-r--r--ishtar_common/templates/blocks/action_list.html2
-rw-r--r--ishtar_common/tests.py65
3 files changed, 30 insertions, 39 deletions
diff --git a/ishtar_common/static/js/ishtar-map.js b/ishtar_common/static/js/ishtar-map.js
index d4eb7285d..56694772b 100644
--- a/ishtar_common/static/js/ishtar-map.js
+++ b/ishtar_common/static/js/ishtar-map.js
@@ -871,7 +871,7 @@ var get_map_by_id_test = function (id) {
console.log(map_layers[id][0].getSource())
}
-var get_map_by_id = function (id) {
+var get_features_by_id = function (id) {
if (vector_features[id] == null) {
var base_features = geojson_format.writeFeaturesObject(point_features[id], {decimals: 3});
} else {
diff --git a/ishtar_common/templates/blocks/action_list.html b/ishtar_common/templates/blocks/action_list.html
index 384082ad4..b2db52f84 100644
--- a/ishtar_common/templates/blocks/action_list.html
+++ b/ishtar_common/templates/blocks/action_list.html
@@ -1,7 +1,7 @@
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle"
data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
- aria-expanded="false">{{section_label|safe}}</a>
+ aria-expanded="false" id="dropdown-menu-main">{{section_label|safe}}</a>
<div class="dropdown-menu">
{% for label, url, has_children in sections %}
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 73e3dda88..1ab718590 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -47,7 +47,7 @@ from django.core.urlresolvers import reverse
from django.db.models.fields import BooleanField
from django.db.models.fields.related import ForeignKey
from django.template.defaultfilters import slugify
-from django.test import TestCase as BaseTestCase
+from django.test import tag, TestCase as BaseTestCase
from django.test.client import Client
from django.test.runner import DiscoverRunner
@@ -3132,6 +3132,7 @@ class TemplateGenerationTest(TestCase):
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from selenium.webdriver.firefox.webdriver import WebDriver
+@tag("ui")
class SeleniumTests(StaticLiveServerTestCase):
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
@@ -3171,46 +3172,36 @@ class SeleniumTests(StaticLiveServerTestCase):
self.selenium.find_element_by_xpath('//button[@type="submit"][@class="btn btn-primary"]').click()
def setUpDefaultGeoItems(self):
- from django.contrib.gis.geos import GEOSGeometry
- from ishtar_common.models_common import SpatialReferenceSystem
- from archaeological_finds.tests import GeomaticTest
from archaeological_operations.tests import create_operation
+ from archaeological_finds.tests import GeomaticTest as GeomaticFindsTest
ope1 = create_operation(self.user)
ope2 = create_operation(self.user)
+ GeomaticFindsTest.create_cr_with_bfs(ope1, "Point", "Point", ["Polygon", "Point"], "CR Pt Poly Pt")
+ GeomaticFindsTest.create_cr_with_bfs(ope1, "Point", "Polygon", ["Polygon", "Point"], "CR Poly Poly Pt")
+ GeomaticFindsTest.create_cr_with_bfs(ope2, "Polygon", "Point", ["Polygon", "Point"], "CR Pt Poly Pt")
+ GeomaticFindsTest.create_cr_with_bfs(ope2, "Polygon", "Polygon", ["Polygon", "Point"], "CR Poly Poly Pt")
+
+ geom_ope = [
+ [[[[1, 1], [5, 1], [5, 5], [1, 5], [1, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]],
+ [[[6, 3], [9, 2], [9, 4], [6, 3]]]],
+ [3.86111, 3.02778],
+ [3.8, 3]
+ ]
+ geom_cr = [
+ [[[[2, 1], [5, 1], [5, 5], [1, 5], [2, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]],
+ [[[6, 3], [9, 2], [9, 4], [6, 3]]]],
+ [3.86111, 3.02778], #TODO: change it
+ [3.9, 3]
+ ]
+ geom_bf = [
+ [[[[2, 1], [4, 1], [4, 4], [1, 4], [2, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]],
+ [[[6, 3], [9, 2], [9, 4], [6, 3]]]],
+ [4.42105, 2.73684],
+ [3.9, 2.9]
+ ]
+ return [geom_ope, geom_cr, geom_bf]
- wgs84 = SpatialReferenceSystem.objects.get(srid=4326)
- limit = (
- "MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2)),"
- "((6 3,9 2,9 4,6 3)))"
- )
- geom = GEOSGeometry("POINT({} {} {})".format(2, 43, 1), srid=4326)
- geom_2d = GEOSGeometry("POINT({} {})".format(2, 43), srid=4326)
- xy = 2, 43
- geom_params = [limit, geom, geom_2d, xy, wgs84]
-
- ope1 = self.Operation.objects.get(pk=ope1.pk)
- ope1.multi_polygon = limit
- ope1.save()
- ope1 = self.Operation.objects.get(pk=ope1.pk)
- ope1.point = geom
- ope1.x, ope2.y = xy
- ope1.point_source = "P"
- ope1.spatial_reference_system = wgs84
- ope1.point_source_item = "Operation"
- ope1.save()
- ope1 = self.Operation.objects.get(pk=ope1.pk)
- ope2.multi_polygon = limit
- ope2.save()
-
- cr_pt1, (bf_poly_pt1, bf_pt_pt1) = GeomaticTest.create_cr_with_bfs(ope1, "Point", ["Polygon", "Point"],
- "CR Pt Poly Pt", geom_params)
- cr_poly1, (bf_poly_poly1, bf_pt_poly1) = GeomaticTest.create_cr_with_bfs(ope1, "Polygon", ["Polygon", "Point"],
- "CR Poly Poly Pt", geom_params)
- cr_pt2, (bf_poly_pt2, bf_pt_pt2) = GeomaticTest.create_cr_with_bfs(ope2, "Point", ["Polygon", "Point"],
- "CR Pt Poly Pt", geom_params)
- cr_poly2, (bf_poly_poly2, bf_pt_poly2) = GeomaticTest.create_cr_with_bfs(ope2, "Polygon", ["Polygon", "Point"],
- "CR Poly Poly Pt", geom_params)
def scroll(self, element):
self.selenium.execute_script(
"var viewPortHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);"
@@ -3229,7 +3220,7 @@ class SeleniumTests(StaticLiveServerTestCase):
)
print(id)
print(self.selenium.execute_script('return print(arguments[0])', mapid))
- base_features, geo_items_feats = self.selenium.execute_script('return get_map_by_id(arguments[0])', mapid)
+ base_features, geo_items_feats = self.selenium.execute_script('return get_features_by_id(arguments[0])', mapid)
base_features['features'][0]['properties'].pop('name')
dic_base['features'][0]['properties']['id'] = id
print('feat : ', base_features)