Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ and execute tests from those files.
## Running integration tests

File `integration-tests/full_drules_gen.py` is intended to generate drules
files for all 6 themes from main Organic Maps repo. It could be used to understand
files for all 8 themes from main Organic Maps repo. It could be used to understand
which parts of the project are actually used by Organic Maps repo.

Usage:
Expand All @@ -33,5 +33,5 @@ python3 full_drules_gen.py -d ../../../data -o drules --txt
```

This command will run generation for styles - default light, default dark,
outdoors light, outdoors dark, vehicle light, vehicle dark and put `*.bin`
and `*.txt` files into 'drules' subfolder.
outdoors light, outdoors dark, cycling light, cycling dark, vehicle light,
vehicle dark and put `*.bin` and `*.txt` files into 'drules' subfolder.
34 changes: 16 additions & 18 deletions integration-tests/full_drules_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,32 @@
log = logging.getLogger('test_drules_gen')
log.setLevel(logging.INFO)

styles = {
'default_light': ['styles/default/light/style.mapcss', 'styles/default/include'],
'default_dark': ['styles/default/dark/style.mapcss', 'styles/default/include'],
'outdoors_light': ['styles/outdoors/light/style.mapcss', 'styles/outdoors/include'],
'outdoors_dark': ['styles/outdoors/dark/style.mapcss', 'styles/outdoors/include'],
'vehicle_light': ['styles/vehicle/light/style.mapcss', 'styles/vehicle/include'],
'vehicle_dark': ['styles/vehicle/dark/style.mapcss', 'styles/vehicle/include'],
}
# Keep vehicle last: every style rewrites visibility.txt & classificator.txt in the data dir,
# and the apps ship the ones produced by the vehicle style.
STYLES = ('default', 'outdoors', 'cycling', 'vehicle')
VARIANTS = ('light', 'dark')


def full_styles_regenerate(options):
log.info("Start generating styles")
libkomwm.MULTIPROCESSING = False
prio_ranges_orig = deepcopy(libkomwm.prio_ranges)

for name, (style_path, include_path) in styles.items():
log.info(f"Generating {name} style ...")
for style in STYLES:
for variant in VARIANTS:
name = f'{style}_{variant}'
log.info(f"Generating {name} style ...")

# Restore initial state
libkomwm.prio_ranges = deepcopy(prio_ranges_orig)
libkomwm.visibilities = {}
# Restore initial state
libkomwm.prio_ranges = deepcopy(prio_ranges_orig)
libkomwm.visibilities = {}

options.filename = options.data + '/' + style_path
options.priorities_path = options.data + '/' + include_path
options.outfile = options.outdir + '/' + name
options.filename = f'{options.data}/styles/{style}/{variant}/style.mapcss'
options.priorities_path = f'{options.data}/styles/{style}/include'
options.outfile = f'{options.outdir}/{name}'

# Run generation
libkomwm.komap_mapswithme(options)
# Run generation
libkomwm.komap_mapswithme(options)
log.info("Done!")

def main():
Expand Down
6 changes: 5 additions & 1 deletion src/libkomwm.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,11 @@ def rule_sort_key(dict_):
for st in zstyle:
if st.get('casing-width') not in (None, 0) or st.get('casing-width-add') is not None: # and (st.get('width') or st.get('fill-color')):
is_area_st = 'fill-color' in st
if has_lines and not is_area_st and st.get('casing-linecap', 'butt') == 'butt':
# Automatic casings belong to ::default and may use any cap.
# Preserve the legacy behavior for explicitly named line objects.
if (has_lines and not is_area_st and
(st.get('object-id') == '::default' or
st.get('casing-linecap', 'butt') == 'butt')):
dr_line = LineRule()

base_width = st.get('width', 0)
Expand Down