class TestSRSConditionalLayers(object): def setup(self): self.l4326 = MockLayer() self.l900913 = MockLayer() self.l32632 = MockLayer() self.layer = SRSConditional( [ (self.l4326, (SRS("EPSG:4326"),)), (self.l900913, (SRS("EPSG:900913"), SRS("EPSG:31467"))), (self.l32632, (SRSConditional.PROJECTED,)), ], GLOBAL_GEOGRAPHIC_EXTENT, ) def test_srs_match(self): assert self.layer._select_layer(SRS(4326)) == self.l4326 assert self.layer._select_layer(SRS(900913)) == self.l900913 assert self.layer._select_layer(SRS(31467)) == self.l900913 def test_srs_match_type(self): assert self.layer._select_layer(SRS(31466)) == self.l32632 assert self.layer._select_layer(SRS(32633)) == self.l32632 def test_no_match_first_type(self): assert self.layer._select_layer(SRS(4258)) == self.l4326
def test_srs_conditional_layers(): l4326 = MockLayer() l900913 = MockLayer() l32632 = MockLayer() layer = SRSConditional([ (l4326, (SRS('EPSG:4326'), )), (l900913, (SRS('EPSG:900913'), SRS('EPSG:31467'))), (l32632, (SRSConditional.PROJECTED, )), ], GLOBAL_GEOGRAPHIC_EXTENT) # srs match assert layer._select_layer(SRS(4326)) == l4326 assert layer._select_layer(SRS(900913)) == l900913 assert layer._select_layer(SRS(31467)) == l900913 # type match (projected) assert layer._select_layer(SRS(31466)) == l32632 assert layer._select_layer(SRS(32633)) == l32632 # fallback is first layer assert layer._select_layer(SRS(4258)) == l4326
class TestSRSConditionalLayers(object): def setup(self): self.l4326 = MockLayer() self.l900913 = MockLayer() self.l32632 = MockLayer() self.layer = SRSConditional([ (self.l4326, (SRS('EPSG:4326'),)), (self.l900913, (SRS('EPSG:900913'), SRS('EPSG:31467'))), (self.l32632, (SRSConditional.PROJECTED,)), ], GLOBAL_GEOGRAPHIC_EXTENT) def test_srs_match(self): assert self.layer._select_layer(SRS(4326)) == self.l4326 assert self.layer._select_layer(SRS(900913)) == self.l900913 assert self.layer._select_layer(SRS(31467)) == self.l900913 def test_srs_match_type(self): assert self.layer._select_layer(SRS(31466)) == self.l32632 assert self.layer._select_layer(SRS(32633)) == self.l32632 def test_no_match_first_type(self): assert self.layer._select_layer(SRS(4258)) == self.l4326
def test_srs_conditional_layers(): l4326 = MockLayer() l3857 = MockLayer() l25832 = MockLayer() preferred = PreferredSrcSRS() preferred.add(SRS(31467), [SRS(25832), SRS(3857)]) layer = SRSConditional([ (l4326, SRS(4326)), (l3857, SRS(3857)), (l25832, SRS(25832)), ], GLOBAL_GEOGRAPHIC_EXTENT, preferred_srs=preferred, ) # srs match assert layer._select_layer(SRS(4326)) == l4326 assert layer._select_layer(SRS(3857)) == l3857 assert layer._select_layer(SRS(25832)) == l25832 # type match (projected) assert layer._select_layer(SRS(31466)) == l3857 assert layer._select_layer(SRS(32633)) == l3857 assert layer._select_layer(SRS(4258)) == l4326 # preferred assert layer._select_layer(SRS(31467)) == l25832