Skip to content

Commit

Permalink
consider aliases in tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Nov 4, 2024
1 parent d71a930 commit a0d4618
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 45 deletions.
6 changes: 3 additions & 3 deletions tests/test_projectgen_extension_optimization_smart1.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def _extopt_staedtische(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 2
for tab in efc.tabs():
if tab.name() == "gebaeude":
if tab.name() == "Gebaeude":
count += 1
assert len(tab.children()) == 1
# should find 1
Expand Down Expand Up @@ -739,7 +739,7 @@ def _extopt_polymorphic(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 2
for tab in efc.tabs():
if tab.name() == "gebaeude":
if tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude":
count += 1
assert len(tab.children()) == 1
# should find 1
Expand Down Expand Up @@ -1165,7 +1165,7 @@ def _extopt_baustruct(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 2
for tab in efc.tabs():
if tab.name() == "strassen_gebaeude":
if tab.name() == "Strassen_Gebaeude":
count += 1
assert len(tab.children()) == 1
# should find 1 (one times gebaeude)
Expand Down
107 changes: 65 additions & 42 deletions tests/test_projectgen_extension_optimization_smart2.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,16 +386,19 @@ def _extopt_staedtische_none(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 5
for tab in efc.tabs():
if tab.name() == "stadtscng_v1_1freizeit_gebaeude":
if tab.name() == "Freizeit.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "stadtscng_v1_1gewerbe_gebaeude":
if tab.name() == "Gewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "kantnl_ng_v1_1konstruktionen_gebaeude":
if (
tab.name()
== "Kantonale_Ortsplanung_V1_1.Konstruktionen.Gebaeude"
):
count += 1
assert len(tab.children()) == 1
if tab.name() == "gebaeude":
if tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude":
count += 1
assert len(tab.children()) == 1
# should find 4
Expand Down Expand Up @@ -609,17 +612,20 @@ def _extopt_staedtische_group(self, generator, strategy):
# one general and two relation editors
assert len(efc.tabs()) == 3
for tab in efc.tabs():
if tab.name() == "stadtscng_v1_1freizeit_gebaeude":
if tab.name() == "Freizeit.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "stadtscng_v1_1gewerbe_gebaeude":
if tab.name() == "Gewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if (
tab.name() == "kantnl_ng_v1_1konstruktionen_gebaeude"
tab.name()
== "Kantonale_Ortsplanung_V1_1.Konstruktionen.Gebaeude"
): # should not happen
count += 1
if tab.name() == "gebaeude": # should not happen
if (
tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude"
): # should not happen
count += 1
# should find only 2

Expand Down Expand Up @@ -805,17 +811,20 @@ def _extopt_staedtische_hide(self, generator, strategy):
# one general and two relation editors
assert len(efc.tabs()) == 3
for tab in efc.tabs():
if tab.name() == "stadtscng_v1_1freizeit_gebaeude":
if tab.name() == "Freizeit.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "stadtscng_v1_1gewerbe_gebaeude":
if tab.name() == "Gewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if (
tab.name() == "kantnl_ng_v1_1konstruktionen_gebaeude"
tab.name()
== "Kantonale_Ortsplanung_V1_1.Konstruktionen.Gebaeude"
): # should not happen
count += 1
if tab.name() == "gebaeude": # should not happen
if (
tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude"
): # should not happen
count += 1
# should find only 2
assert count == 2
Expand Down Expand Up @@ -1250,28 +1259,28 @@ def _extopt_polymorphic_none(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 9
for tab in efc.tabs():
if tab.name() == "gebaeude":
if tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1gewerbe_gebaeude":
if tab.name() == "Gewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1freizeit_gebaeude":
if tab.name() == "Freizeit.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1industriegewerbe_gebaeude":
if tab.name() == "IndustrieGewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1hallen_gebaeude":
if tab.name() == "Hallen.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "markthalle":
if tab.name() == "Markthalle":
count += 1
assert len(tab.children()) == 1
if tab.name() == "turnhalletyp1":
if tab.name() == "TurnhalleTyp1":
count += 1
assert len(tab.children()) == 1
if tab.name() == "turnhalletyp2":
if tab.name() == "TurnhalleTyp2":
count += 1
assert len(tab.children()) == 1
# should find 8
Expand Down Expand Up @@ -1517,28 +1526,30 @@ def _extopt_polymorphic_group(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 8
for tab in efc.tabs():
if tab.name() == "gebaeude": # this should not happen
if (
tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude"
): # this should not happen
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1gewerbe_gebaeude":
if tab.name() == "Gewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1freizeit_gebaeude":
if tab.name() == "Freizeit.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1industriegewerbe_gebaeude":
if tab.name() == "IndustrieGewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1hallen_gebaeude":
if tab.name() == "Hallen.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "markthalle":
if tab.name() == "Markthalle":
count += 1
assert len(tab.children()) == 1
if tab.name() == "turnhalletyp1":
if tab.name() == "TurnhalleTyp1":
count += 1
assert len(tab.children()) == 1
if tab.name() == "turnhalletyp2":
if tab.name() == "TurnhalleTyp2":
count += 1
assert len(tab.children()) == 1
# should find 7
Expand Down Expand Up @@ -1764,28 +1775,30 @@ def _extopt_polymorphic_hide(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 8
for tab in efc.tabs():
if tab.name() == "gebaeude": # this should not happen
if (
tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude"
): # this should not happen
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1gewerbe_gebaeude":
if tab.name() == "Gewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1freizeit_gebaeude":
if tab.name() == "Freizeit.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1industriegewerbe_gebaeude":
if tab.name() == "IndustrieGewerbe.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "polymrpng_v1_1hallen_gebaeude":
if tab.name() == "Hallen.Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "markthalle":
if tab.name() == "Markthalle":
count += 1
assert len(tab.children()) == 1
if tab.name() == "turnhalletyp1":
if tab.name() == "TurnhalleTyp1":
count += 1
assert len(tab.children()) == 1
if tab.name() == "turnhalletyp2":
if tab.name() == "TurnhalleTyp2":
count += 1
assert len(tab.children()) == 1
# should find 7
Expand Down Expand Up @@ -2212,10 +2225,13 @@ def _extopt_baustruct_none(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 4
for tab in efc.tabs():
if tab.name() == "kantnl_ng_v1_1konstruktionen_gebaeude":
if (
tab.name()
== "Kantonale_Bauplanung_V1_1.Konstruktionen.Gebaeude"
):
count += 1
assert len(tab.children()) == 1
if tab.name() == "gebaeude":
if tab.name() == "Bauplanung_V1_1.Konstruktionen.Gebaeude":
count += 1
assert len(tab.children()) == 1
# should find 3 (one times gebaeude and two times kantnl_ng_v1_1konstruktionen_gebaeude because it's extended)
Expand Down Expand Up @@ -2431,10 +2447,15 @@ def _extopt_baustruct_group(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 2
for tab in efc.tabs():
if tab.name() == "kantnl_ng_v1_1konstruktionen_gebaeude":
if (
tab.name()
== "Kantonale_Bauplanung_V1_1.Konstruktionen.Gebaeude"
):
count += 1
assert len(tab.children()) == 1
if tab.name() == "gebaeude": # this should not happen
if (
tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude"
): # this should not happen
count += 1
assert len(tab.children()) == 1
# should find 1 (one times kantnl_ng_v1_1konstruktionen_gebaeude)
Expand Down Expand Up @@ -2613,10 +2634,12 @@ def _extopt_baustruct_hide(self, generator, strategy):
# one general and four relation editors
assert len(efc.tabs()) == 2
for tab in efc.tabs():
if tab.name() == "kantnl_ng_v1_1konstruktionen_gebaeude":
if tab.name() == "Gebaeude":
count += 1
assert len(tab.children()) == 1
if tab.name() == "gebaeude": # this should not happen
if (
tab.name() == "Ortsplanung_V1_1.Konstruktionen.Gebaeude"
): # this should not happen
count += 1
assert len(tab.children()) == 1
# should find 1 (one times kantnl_ng_v1_1konstruktionen_gebaeude)
Expand Down

0 comments on commit a0d4618

Please sign in to comment.