summaryrefslogtreecommitdiff
path: root/test/navigation
diff options
context:
space:
mode:
Diffstat (limited to 'test/navigation')
-rw-r--r--test/navigation/README.md8
-rwxr-xr-xtest/navigation/script/test-address-input.py13
-rwxr-xr-xtest/navigation/script/test-all10
-rwxr-xr-xtest/navigation/script/test-guidance.py16
-rwxr-xr-xtest/navigation/script/test-location-input.py15
-rwxr-xr-xtest/navigation/script/test-map-viewer-control.py13
-rwxr-xr-xtest/navigation/script/test-poi.py60
-rwxr-xr-xtest/navigation/script/test-route-calculation.py13
8 files changed, 98 insertions, 50 deletions
diff --git a/test/navigation/README.md b/test/navigation/README.md
index d32bfe4..1cc1225 100644
--- a/test/navigation/README.md
+++ b/test/navigation/README.md
@@ -3,6 +3,7 @@
These folders contain several files that allow to test the navigation.
The folder ./script contains the ones for the GlibDBus version:
+test-poi.py
test-location-input.py
test-address-input.py
test-map-viewer-control.py
@@ -17,7 +18,7 @@ The folder ./resource contains the resource files (e.g. the address) used as inp
The folder ./log contains the generated sequence charts (see below)
-There's a mechanism to trig with DLT, so it's necessary to build some stuff before.
+There's a optional mechanism to trig with DLT, please build the stuff in dlt-triggers before:
##How to build the trigger
Under ./dlt-triggers
@@ -31,13 +32,14 @@ make install
##Tested targets
Desktop: Tested under Ubuntu 16.04 LTS 64 bits
##How-to test
-First, open a new terminal and launch the navigation by entering:
+First, open a new terminal and launch the navigation and the poi server by entering:
```
-./run -r
+./run -r -p
```
Unitary tests:
(under ./script folder)
```
+./test-poi.py -l ../resource/location.xml
./test-location-input.py -l locations.xml
./test-route-calculation.py -r routes.xml
./test-address-input.py -l location.xml
diff --git a/test/navigation/script/test-address-input.py b/test/navigation/script/test-address-input.py
index 4ba732f..ff273f0 100755
--- a/test/navigation/script/test-address-input.py
+++ b/test/navigation/script/test-address-input.py
@@ -37,7 +37,12 @@ import argparse
import sys
import errno
import genivi
-from dltTrigger import *
+try:
+ from dltTrigger import *
+ dltTrigger=True
+ print('DLT signal sent')
+except dltTriggerNotBuilt:
+ dltTrigger=False
#import pdb;pdb.set_trace()
#name of the test
@@ -337,7 +342,8 @@ def exit():
print('Delete location input: '+str(int(error)))
error=session_interface.DeleteSession(dbus.UInt32(session_handle))
print('Delete session: '+str(int(error)))
- stopTrigger(test_name)
+ if dltTrigger==True:
+ stopTrigger(test_name)
loop.quit()
@@ -356,7 +362,8 @@ def startSearch(address_index):
change_selection_criterion(genivi.COUNTRY)
full_string_search(location_input_handle, target_search_string)
-startTrigger(test_name)
+if dltTrigger==True:
+ startTrigger(test_name)
session = bus.get_object('org.genivi.navigation.navigationcore.Session', '/org/genivi/navigationcore')
session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigation.navigationcore.Session')
diff --git a/test/navigation/script/test-all b/test/navigation/script/test-all
index f2c8dfa..0f54f73 100755
--- a/test/navigation/script/test-all
+++ b/test/navigation/script/test-all
@@ -1,11 +1,13 @@
#!/bin/bash
+./test-poi.py -l ../resource/location.xml
+sleep 1
./test-location-input.py -l ../resource/locations.xml
-sleep 2
+sleep 1
./test-route-calculation.py -r ../resource/routes.xml
-sleep 2
+sleep 1
./test-address-input.py -l ../resource/location.xml
-sleep 2
+sleep 1
./test-guidance.py -r ../resource/route.xml
-sleep 2
+sleep 1
./test-map-viewer-control.py -l ../resource/location.xml
diff --git a/test/navigation/script/test-guidance.py b/test/navigation/script/test-guidance.py
index 74be6ac..8f91a77 100755
--- a/test/navigation/script/test-guidance.py
+++ b/test/navigation/script/test-guidance.py
@@ -36,9 +36,13 @@ import sys
import errno
import time
import genivi
-from dltTrigger import *
-#import pdb
-#pdb.set_trace()
+try:
+ from dltTrigger import *
+ dltTrigger=True
+ print('DLT signal sent')
+except dltTriggerNotBuilt:
+ dltTrigger=False
+#import pdb;pdb.set_trace()
#name of the test
test_name = "guidance"
@@ -135,7 +139,8 @@ def timeout():
exit()
def exit():
- stopTrigger(test_name)
+ if dltTrigger==True:
+ stopTrigger(test_name)
loop.quit()
def display_route(route):
@@ -302,7 +307,8 @@ bus.add_signal_receiver(mapmatchedposition_simulationStatusChanged_handler, \
dbus_interface = "org.genivi.navigation.navigationcore.MapMatchedPosition", \
signal_name = "SimulationStatusChanged")
-startTrigger(test_name)
+if dltTrigger==True:
+ startTrigger(test_name)
navigationcore_session_obj = bus.get_object('org.genivi.navigation.navigationcore.Session','/org/genivi/navigationcore')
g_navigationcore_session_interface = dbus.Interface(navigationcore_session_obj, dbus_interface='org.genivi.navigation.navigationcore.Session')
diff --git a/test/navigation/script/test-location-input.py b/test/navigation/script/test-location-input.py
index c16388e..d7c5adc 100755
--- a/test/navigation/script/test-location-input.py
+++ b/test/navigation/script/test-location-input.py
@@ -37,7 +37,12 @@ import argparse
import sys
import errno
import genivi
-from dltTrigger import *
+try:
+ from dltTrigger import *
+ dltTrigger=True
+ print('DLT signal sent')
+except dltTriggerNotBuilt:
+ dltTrigger=False
#import pdb;pdb.set_trace()
#name of the test
@@ -421,7 +426,8 @@ def exit():
print('Delete location input: '+str(int(error)))
error=session_interface.DeleteSession(dbus.UInt32(session_handle))
print('Delete session: '+str(int(error)))
- stopTrigger(test_name)
+ if dltTrigger==True:
+ stopTrigger(test_name)
loop.quit()
def startSearch(address_index):
@@ -445,8 +451,9 @@ def startSearch(address_index):
elif country_search_mode == 1:
full_string_search(location_input_handle, target_search_string)
-startTrigger(test_name)
-
+if dltTrigger==True:
+ startTrigger(test_name)
+
session = bus.get_object('org.genivi.navigation.navigationcore.Session', '/org/genivi/navigationcore')
session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigation.navigationcore.Session')
diff --git a/test/navigation/script/test-map-viewer-control.py b/test/navigation/script/test-map-viewer-control.py
index 51ec581..03bb5ff 100755
--- a/test/navigation/script/test-map-viewer-control.py
+++ b/test/navigation/script/test-map-viewer-control.py
@@ -32,12 +32,17 @@ import dbus
import gobject
import dbus.mainloop.glib
import time
-from dltTrigger import *
import xml.dom.minidom
import argparse
import sys
import errno
import genivi
+try:
+ from dltTrigger import *
+ dltTrigger=True
+ print('DLT signal sent')
+except dltTriggerNotBuilt:
+ dltTrigger=False
#import pdb; pdb.set_trace()
#name of the test
@@ -185,7 +190,8 @@ def exit():
dbus.UInt32(sessionhandle), \
dbus.UInt32(mapviewerhandle))
session_interface.DeleteSession(sessionhandle)
- stopTrigger(test_name)
+ if dltTrigger==True:
+ stopTrigger(test_name)
loop.quit()
def next_step():
@@ -256,7 +262,8 @@ bus.add_signal_receiver(mapviewer_mapViewPerspectiveChanged_handler, \
dbus_interface = "org.genivi.navigation.mapviewer.MapViewerControl", \
signal_name = "MapViewPerspectiveChanged")
-startTrigger(test_name)
+if dltTrigger==True:
+ startTrigger(test_name)
session = bus.get_object('org.genivi.navigation.mapviewer.Session','/org/genivi/mapviewer')
session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigation.mapviewer.Session')
diff --git a/test/navigation/script/test-poi.py b/test/navigation/script/test-poi.py
index 56628d3..6610a48 100755
--- a/test/navigation/script/test-poi.py
+++ b/test/navigation/script/test-poi.py
@@ -28,12 +28,17 @@
import dbus
import gobject
import dbus.mainloop.glib
-from dltTrigger import *
import xml.dom.minidom
import argparse
import sys
import errno
import genivi
+try:
+ from dltTrigger import *
+ dltTrigger=True
+ print('DLT signal sent')
+except dltTriggerNotBuilt:
+ dltTrigger=False
#import pdb; pdb.set_trace()
#name of the test
@@ -49,8 +54,8 @@ ID_RESTAURANT = 260
ATTRIBUTE_SOURCE = 0
ATTRIBUTE_PHONE = 2
RADIUS_HOTEL = 100 #in tenth of meter !
-RADIUS_FUEL = 500
-STRING_TO_SEARCH = "Alpes"
+RADIUS_RESTAURANT = 500
+STRING_TO_SEARCH = "hof"
MAX_WINDOW_SIZE = 100
OFFSET = 0
@@ -82,19 +87,22 @@ def catch_poi_poiStatus_signal_handler(poiSearchHandle,statusValue):
def catch_poi_resultListChanged_signal_handler(poiSearchHandle,resultListSize):
poiList=[]
- if poiSearchHandle == g_searchHandle and resultListSize != 0:
- ret=g_poiSearch_interface.RequestResultList(dbus.UInt32(poiSearchHandle),dbus.UInt16(OFFSET),dbus.UInt16(MAX_WINDOW_SIZE),[ATTRIBUTE_SOURCE,ATTRIBUTE_PHONE])
- if ret[0] == genivi.SEARCH_FINISHED and ret[1] >= 0:
- print("Results: "+str(int(ret[1])))
- for result in ret[2]:
- poiList.append(result[0])
- ret=g_poiSearch_interface.GetPoiDetails(poiList)
- for resultDetail in ret:
- if resultDetail[1][0] == ID_HOTEL:
- print("Hotel: " +resultDetail[0][1])
- elif resultDetail[1][0] == ID_FUEL:
- print("Fuel: " +resultDetail[0][1])
- g_poiSearch_interface.CancelPoiSearch(dbus.UInt32(poiSearchHandle))
+ if poiSearchHandle == g_searchHandle:
+ if resultListSize != 0:
+ ret=g_poiSearch_interface.RequestResultList(dbus.UInt32(poiSearchHandle),dbus.UInt16(OFFSET),dbus.UInt16(MAX_WINDOW_SIZE),[ATTRIBUTE_SOURCE,ATTRIBUTE_PHONE])
+ if ret[0] == genivi.SEARCH_FINISHED and ret[1] >= 0:
+ print("Results: "+str(int(ret[1])))
+ for result in ret[2]:
+ poiList.append(result[0])
+ ret=g_poiSearch_interface.GetPoiDetails(poiList)
+ for resultDetail in ret:
+ if resultDetail[1][0] == ID_HOTEL:
+ print("Hotel: " +resultDetail[0][1])
+ elif resultDetail[1][0] == ID_RESTAURANT:
+ print("Restaurant: " +resultDetail[0][1])
+ g_poiSearch_interface.CancelPoiSearch(dbus.UInt32(poiSearchHandle))
+ else:
+ g_poiSearch_interface.CancelPoiSearch(dbus.UInt32(poiSearchHandle))
def timeout():
print ('Timeout Expired')
@@ -102,7 +110,8 @@ def timeout():
exit()
def exit():
- stopTrigger(test_name)
+ if dltTrigger==True:
+ stopTrigger(test_name)
loop.quit()
@@ -143,7 +152,7 @@ for location in location_set.getElementsByTagName("location"):
if __name__ == '__main__':
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
-print("Search for hotel and fuel with keyword: "+ STRING_TO_SEARCH)
+print("Search for hotel and restaurant with keyword: "+ STRING_TO_SEARCH)
#connect to session bus
bus = dbus.SessionBus()
@@ -160,7 +169,8 @@ bus.add_signal_receiver(catch_poi_resultListChanged_signal_handler, \
dbus_interface = "org.genivi.navigation.poiservice.POISearch", \
signal_name = "ResultListChanged")
-startTrigger(test_name)
+if dltTrigger==True:
+ startTrigger(test_name)
poiConfiguration = bus.get_object('org.genivi.navigation.poiservice.POIConfiguration','/org/genivi/poiservice/POIConfiguration')
g_poiConfiguration_interface = dbus.Interface(poiConfiguration, dbus_interface='org.genivi.navigation.poiservice.POIConfiguration')
@@ -176,13 +186,13 @@ g_poiConfiguration_interface.SetLocale(dbus.String("fra"),dbus.String("FRA"),dbu
categories=[]
ret=g_poiSearch_interface.GetAvailableCategories()
for categoryAndName in ret:
- if categoryAndName[0] == ID_HOTEL or categoryAndName[0] == ID_FUEL:
+ if categoryAndName[0] == ID_HOTEL or categoryAndName[0] == ID_RESTAURANT:
print("Category ID: " + str(int(categoryAndName[0])))
categories.append(categoryAndName[0])
print("Name: " + categoryAndName[1])
attributes_hotel=[]
-attributes_fuel=[]
+attributes_restaurant=[]
attributesDetails=[]
ret=g_poiSearch_interface.GetCategoriesDetails(categories)
for results in ret:
@@ -190,10 +200,10 @@ for results in ret:
for attribute in results[1]:
attributes_hotel.append(attribute[0])
attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_HOTEL),dbus.Int32(1280),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(1314),dbus.Boolean(False)]))
- elif results[0][0] == ID_FUEL:
+ elif results[0][0] == ID_RESTAURANT:
for attribute in results[1]:
- attributes_fuel.append(attribute[0])
- attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_FUEL),dbus.Int32(1280),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(1314),dbus.Boolean(False)]))
+ attributes_restaurant.append(attribute[0])
+ attributesDetails.append(dbus.Struct([dbus.UInt32(attribute[0]),dbus.UInt32(ID_RESTAURANT),dbus.Int32(1280),dbus.Struct([dbus.Byte(2),dbus.String("")]),dbus.Int32(1314),dbus.Boolean(False)]))
ret=g_poiSearch_interface.GetRootCategory()
@@ -208,7 +218,7 @@ alt = ALTITUDE[index]
g_poiSearch_interface.SetCenter(g_searchHandle,dbus.Struct([dbus.Double(lat),dbus.Double(lon),dbus.Double(alt)]))
-g_poiSearch_interface.SetCategories(g_searchHandle,[dbus.Struct([dbus.UInt32(ID_HOTEL),dbus.UInt32(RADIUS_HOTEL)]),dbus.Struct([dbus.UInt32(ID_FUEL),dbus.UInt32(RADIUS_FUEL)])])
+g_poiSearch_interface.SetCategories(g_searchHandle,[dbus.Struct([dbus.UInt32(ID_HOTEL),dbus.UInt32(RADIUS_HOTEL)]),dbus.Struct([dbus.UInt32(ID_RESTAURANT),dbus.UInt32(RADIUS_RESTAURANT)])])
g_poiSearch_interface.SetAttributes(g_searchHandle,attributesDetails)
diff --git a/test/navigation/script/test-route-calculation.py b/test/navigation/script/test-route-calculation.py
index 29dcfd5..0a34429 100755
--- a/test/navigation/script/test-route-calculation.py
+++ b/test/navigation/script/test-route-calculation.py
@@ -36,8 +36,13 @@ import argparse
import sys
import errno
import genivi
+try:
+ from dltTrigger import *
+ dltTrigger=True
+ print('DLT signal sent')
+except dltTriggerNotBuilt:
+ dltTrigger=False
#import pdb;pdb.set_trace()
-from dltTrigger import *
#name of the test
test_name = "route calculation"
@@ -146,7 +151,8 @@ def timeout():
exit()
def exit():
- stopTrigger(test_name)
+ if dltTrigger==True:
+ stopTrigger(test_name)
loop.quit()
def launch_route_calculation(route):
@@ -178,7 +184,8 @@ def launch_route_calculation(route):
#calculate route
g_routing_interface.CalculateRoute(dbus.UInt32(g_session_handle),dbus.UInt32(g_route_handle))
-startTrigger(test_name)
+if dltTrigger==True:
+ startTrigger(test_name)
session = bus.get_object('org.genivi.navigation.navigationcore.Session','/org/genivi/navigationcore')
g_session_interface = dbus.Interface(session, dbus_interface='org.genivi.navigation.navigationcore.Session')