Skip to content

Commit

Permalink
Resource Sharing Plugin Tests Added
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jan 31, 2017
1 parent b3de34a commit 248c583
Show file tree
Hide file tree
Showing 32 changed files with 2,974 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/plugins/ResourceSharing/CMakeLists.txt
@@ -1,5 +1,5 @@
FILE(GLOB PY_FILES)
PLUGIN_INSTALL(ResourceSharing . ${PY_FILES} __init__.py metadata.txt LICENSE.txt)
FILE(GLOB PY_FILES *.py)
PLUGIN_INSTALL(ResourceSharing . ${PY_FILES} metadata.txt LICENSE.txt)

FOREACH(dir
processing
Expand All @@ -25,3 +25,5 @@ resources/template)
ENDFOREACH(_item)
PLUGIN_INSTALL(ResourceSharing ${dir} ${_files})
ENDFOREACH(dir)

ADD_SUBDIRECTORY(test)
38 changes: 38 additions & 0 deletions python/plugins/ResourceSharing/test/CMakeLists.txt
@@ -0,0 +1,38 @@
FILE(GLOB PY_FILES *.py)
FILE(GLOB TEST_DATA_FILES testdata/points.* testdata/table.dbf)

PLUGIN_INSTALL(ResourceSharing test ${PY_FILES})
PLUGIN_INSTALL(ResourceSharing test/testdata ${TEST_DATA_FILES})

IF(ENABLE_TESTS)

FOREACH(dir
gui
data
data/collections
data/collections/test_collection
data/collections/test_collection/preview
data/collections/test_collection/svg
data/collections/test_collection/processing
data/collections/test_collection/image
data/collections/test_collection/symbol
data/collections/test_collection/style
repository_handler
resource_handler
)
FILE(GLOB _items ${dir}/*)
SET(_files)
FOREACH(_item ${_items})
IF(NOT IS_DIRECTORY ${_item})
LIST(APPEND _files ${_item})
ENDIF(NOT IS_DIRECTORY ${_item})
ENDFOREACH(_item)
PLUGIN_INSTALL(ResourceSharing test/${dir} ${_files})
ENDFOREACH(dir)


INCLUDE(UsePythonTest)
ADD_PYTHON_TEST(ResourceSharingInitTest test_init.py)
ADD_PYTHON_TEST(ResourceSharingCollectionManagerTest test_collections_manager.py)
ADD_PYTHON_TEST(ResourceSharingSymbolXmlExtractorTest test_symbol_xml_extractor.py)
ENDIF(ENABLE_TESTS)
5 changes: 5 additions & 0 deletions python/plugins/ResourceSharing/test/__init__.py
@@ -0,0 +1,5 @@
# import qgis libs so that ve set the correct sip api version
import qgis # pylint: disable=W0611 # NOQA
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'ext_libs')))
1 change: 1 addition & 0 deletions python/plugins/ResourceSharing/test/data/README.md
@@ -0,0 +1 @@
# QGIS-style-repo-dummy

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,17 @@
##Points=group
##Input_raster=raster
##Input_vector=vector
##Output_layer=output vector

from qgis.core import *

vector = processing.getObject(Input_vector)
raster = processing.getObject(Input_raster)

geometryType = vector.geometryType()
if geometryType == QGis.Point:
processing.runalg('qgis:saveselectedfeatures', vector, Output_layer)
elif geometryType == QGis.Line:
processing.runalg('qgis:generatepointspixelcentroidsalongline', raster, vector, Output_layer)
elif geometryType == QGis.Polygon:
processing.runalg('qgis:generatepointspixelcentroidsinsidepolygons', raster, vector, Output_layer)

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 248c583

Please sign in to comment.