forked from ChaoticOnyx/OnyxBay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18141 from PsiOmegaDelta/170807-KeepYourArtsyAmbi…
…tionsAway Adds a test to check icon state limits.
- Loading branch information
Showing
8 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import argparse, re, sys | ||
from os import path, walk | ||
import dmitool # This import is why this script is here. If someone can import this file cleanly from [repo root]/test/ instead, feel free | ||
|
||
opt = argparse.ArgumentParser() | ||
opt.add_argument('dir', help='The directory to scan for *.dmi files with an excess number of icon states.') | ||
args = opt.parse_args() | ||
|
||
if(not path.isdir(args.dir)): | ||
print('Not a directory') | ||
sys.exit(1) | ||
|
||
bad_dmi_files = [] | ||
|
||
# This section parses all *.dmi files in the given directory, recursively. | ||
for root, subdirs, files in walk(args.dir): | ||
for filename in files: | ||
if filename.endswith('.dmi'): | ||
file_path = path.join(root, filename) | ||
dmi_info = dmitool.info(file_path) | ||
number_of_icon_states = len(dmi_info["states"]) | ||
print("{0} - {1}".format(file_path, number_of_icon_states)) | ||
if number_of_icon_states > 512: | ||
bad_dmi_files.append((file_path, number_of_icon_states)) | ||
|
||
if len(bad_dmi_files) > 0: | ||
for dmi_path, icon_states in bad_dmi_files: | ||
print("{0} had too many icon states. {1}/512.".format(dmi_path, icon_states)) | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters