1 parent
a238ff5e23
commit
93762fe9ef
65 files changed
+5420
-2792
No files matched your search
@@ -31,10 +31,11 @@ def test_schema_and_response_templates():
|
||||
migrations = sorted(ROOT.joinpath("migrations").glob("V*.sql"))
|
||||
for migration in migrations:
|
||||
conn.executescript(migration.read_text())
|
||||
assert int(migrations[-1].name[1:4]) == 45
|
||||
assert int(migrations[-1].name[1:4]) == 46
|
||||
display_columns = {row[1] for row in conn.execute("pragma table_info(display_preferences)")}
|
||||
response_columns = {row[1] for row in conn.execute("pragma table_info(response_templates)")}
|
||||
assert "interface_skin" in display_columns
|
||||
assert "preset_scale_unlocked" in display_columns
|
||||
assert "format" in response_columns
|
||||
conn.execute("insert into response_templates(name,body,format) values (?,?,?)", ("Text", "Hello", "text"))
|
||||
conn.execute("insert into response_templates(name,body,format) values (?,?,?)", ("HTML", "<b>Hello</b>", "html"))
|
||||
@@ -51,8 +52,14 @@ def test_html_contract():
|
||||
assert "#icon-arrow-left" in source
|
||||
assert "pref-interface-skin" in source
|
||||
assert "compose-response-template" in source
|
||||
assert 'data-default-theme="__RUSTBOX_DEFAULT_THEME__"' in source
|
||||
assert 'id="folder-quota"' in source
|
||||
assert 'id="folder-quota-bar"' in source
|
||||
assert 'id="reader-to"' in source and 'aria-expanded="false"' in source
|
||||
for control_id in ["message-details-menu", "message-transfer-menu", "reader-move-action", "reader-copy-action", "compose-mode"]:
|
||||
assert f'id="{control_id}"' in source
|
||||
assert "data-appearance-preset" not in source
|
||||
for value in ["rustbox", "roundcube-classic", "roundcube-larry", "roundcube-elastic", "clean", "graphite", "high-contrast"]:
|
||||
for value in ["rustbox", "roundcube-classic", "roundcube-larry", "roundcube-elastic", "clean", "gmail", "proton", "zoho", "outlook", "minimal", "graphite", "high-contrast", "fastmail", "apple-mail", "yahoo", "hey", "nord"]:
|
||||
assert f'value="{value}"' in source
|
||||
|
||||
|
||||
@@ -71,7 +78,7 @@ def test_roundcube_palette_contract():
|
||||
'roundcube-elastic"][data-theme="dark',
|
||||
]:
|
||||
assert selector in classic_elastic
|
||||
for selector in ["roundcube-larry", "clean", "graphite", "high-contrast"]:
|
||||
for selector in ["roundcube-larry", "clean", "gmail", "proton", "zoho", "outlook", "minimal", "graphite", "high-contrast"]:
|
||||
assert f'data-interface-skin="{selector}"' in extra_styles
|
||||
manifest = (ROOT / "src/web/css/manifest.txt").read_text()
|
||||
assert "55-roundcube-skins.css" in manifest
|
||||
@@ -89,6 +96,12 @@ def test_modular_js_contract():
|
||||
assert '"roundcube-elastic"' in app
|
||||
assert "loadResponseTemplates" in app
|
||||
assert "insertSavedResponse" in app
|
||||
assert "loadQuota();" in app
|
||||
assert "toggleReaderAddressExpansion" in app
|
||||
assert "translateScopedUiText" in app
|
||||
assert "presetScaleUnlocked" in app
|
||||
assert "positionToolbarMenu" in app
|
||||
assert "progressToast" in app
|
||||
assert "appearancePresets" not in app
|
||||
assert "applyAppearancePreset" not in app
|
||||
assert "src/web/js/manifest.txt" in (ROOT / "README.md").read_text()
|
||||
@@ -100,20 +113,42 @@ def test_modular_js_contract():
|
||||
|
||||
def test_backend_skin_contract_and_version():
|
||||
db_source = (ROOT / "src/db/display_preferences.rs").read_text()
|
||||
for value in ["rustbox", "roundcube-classic", "roundcube-larry", "roundcube-elastic", "clean", "graphite", "high-contrast"]:
|
||||
for value in ["rustbox", "roundcube-classic", "roundcube-larry", "roundcube-elastic", "clean", "gmail", "proton", "zoho", "outlook", "minimal", "graphite", "high-contrast", "fastmail", "apple-mail", "yahoo", "hey", "nord"]:
|
||||
assert f'"{value}"' in db_source
|
||||
cargo = (ROOT / "Cargo.toml").read_text()
|
||||
assert 'version = "0.0.2"' in cargo
|
||||
assert 'version = "0.0.3"' in cargo
|
||||
config = (ROOT / "src/config.rs").read_text()
|
||||
assert "pub default_theme: String" in config
|
||||
assert '"system" | "dark" | "light"' in config
|
||||
ui = (ROOT / "src/ui.rs").read_text()
|
||||
assert 'replace("__RUSTBOX_DEFAULT_THEME__", &config.default_theme)' in ui
|
||||
assert "V044__interface_skin.sql" in (ROOT / "src/db/pool.rs").read_text()
|
||||
assert "V045__response_template_format.sql" in (ROOT / "src/db/pool.rs").read_text()
|
||||
assert "V046__preset_scale_unlock.sql" in (ROOT / "src/db/pool.rs").read_text()
|
||||
for path in ROOT.glob("src/web/i18n/*.json"):
|
||||
json.loads(path.read_text())
|
||||
|
||||
|
||||
def test_mobile_003_contract():
|
||||
responsive = (ROOT / "src/web/css/60-responsive.css").read_text()
|
||||
assert '.sieve-builder .checkbox-row input[type="checkbox"]' in responsive
|
||||
assert ".dialog > .dialog-card" in responsive
|
||||
assert "grid-template-rows: auto minmax(0, 1fr)" in responsive
|
||||
assert ".calendar-toolbar" in responsive
|
||||
assert ".message-meta.addresses-expanded" in responsive
|
||||
pl = json.loads((ROOT / "src/web/i18n/pl.json").read_text())
|
||||
assert len(pl.get("_text", {})) >= 450
|
||||
for key in ["Rule enabled", "Stop after this rule", "Calendar", "Message headers", "Message source", "Forward as attachment", "Show headers", "Show source", "Write a message"]:
|
||||
assert key in pl["_text"]
|
||||
for key in ["reply", "reply_all", "forward", "message_details", "move_copy", "move_to", "copy_to"]:
|
||||
assert key in pl
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_schema_and_response_templates()
|
||||
test_html_contract()
|
||||
test_roundcube_palette_contract()
|
||||
test_modular_js_contract()
|
||||
test_backend_skin_contract_and_version()
|
||||
test_mobile_003_contract()
|
||||
print("roundcube-skin-contract: OK")
|
||||
Reference in new issue
Block a user