Пример #1
0
# coding=utf-8
"""Test for Style."""

import unittest

from safe.definitions.utilities import definition
from safe.test.utilities import qgis_iface, load_test_vector_layer
from safe.impact_function.style import layer_title

iface = qgis_iface()

__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "*****@*****.**"
__revision__ = 'e96e916695a1f1d3ab34117194b58dc73d7743a4'


class TestStyle(unittest.TestCase):
    """Test Style."""
    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_title(self):
        """Test we can set the layer title correctly."""
        layer = load_test_vector_layer('impact',
                                       'buildings_without_style.geojson')

        layer_title(layer)
Пример #2
0
import unittest

from safe.test.utilities import qgis_iface, load_test_vector_layer
from safe.definitions.fields import (
    female_count_field, female_ratio_field, size_field, population_count_field)

from safe.gis.vector.from_counts_to_ratios import from_counts_to_ratios
from safe.gis.vector.prepare_vector_layer import prepare_vector_layer

__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "*****@*****.**"
__revision__ = 'b68f9f9b473d275ea4d63c7b831184f2c08e0e6e'

qgis_iface()


class TestRecomputeCounts(unittest.TestCase):

    """Test class."""

    def test_recompute_counts(self):
        """Test we can recompute counts in a layer."""
        layer = load_test_vector_layer(
            'gisv4', 'exposure', 'population.geojson',
            clone=True)

        self.assertIn(
            female_count_field['key'], layer.keywords['inasafe_fields'])
Пример #3
0
# coding=utf-8
"""Test for Style."""

import unittest

from safe.definitions.utilities import definition
from safe.test.utilities import qgis_iface, load_test_vector_layer
from safe.impact_function.style import layer_title

qgis_iface()

__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "*****@*****.**"
__revision__ = 'bc3796555162c60f37041c9b01cea5ad77504d39'


class TestStyle(unittest.TestCase):

    """Test Style."""

    def setUp(self):
        pass

    def tearDown(self):
        pass

    def test_title(self):
        """Test we can set the layer title correctly."""
        layer = load_test_vector_layer(
            'impact', 'buildings_without_style.geojson')
Пример #4
0
    load_test_vector_layer,
    setup_scenario,
    set_canvas_crs,
    populate_dock,
    GEOCRS,
    set_small_jakarta_extent,
    qgis_iface)

__copyright__ = "Copyright 2016, The InaSAFE Project"
__license__ = "GPL version 3"
__email__ = "*****@*****.**"
__revision__ = 'bd00bfeac510722b427544b186bfa10861749e51'

LOGGER = logging.getLogger('InaSAFE')

iface = qgis_iface()


# noinspection PyArgumentList
class TestDock(unittest.TestCase):
    """Test the InaSAFE GUI."""

    @classmethod
    def setUpClass(cls):
        cls.dock = get_dock()

    def setUp(self):
        """Fixture run before all tests."""
        self.dock.show_only_visible_layers_flag = True
        load_standard_layers(self.dock)
        self.dock.hazard_layer_combo.setCurrentIndex(1)