36 lines
1.6 KiB
Python
36 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Source-level regression check for KDE bug 500674 in plasma-nm."""
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
root = Path(sys.argv[1] if len(sys.argv) > 1 else ".")
|
|
list_page = (root / "applet/contents/ui/ConnectionListPage.qml").read_text()
|
|
item_page = (root / "applet/contents/ui/ConnectionItem.qml").read_text()
|
|
model = (root / "libs/models/networkmodelitem.cpp").read_text()
|
|
i = model.find("QString NetworkModelItem::sectionType() const")
|
|
section_fn = model[i:i + 700] if i >= 0 else ""
|
|
|
|
checks = {
|
|
"ConnectionListPage uses PlasmaExtras.ListSectionHeader":
|
|
"section.delegate: PlasmaExtras.ListSectionHeader" in list_page,
|
|
'section.property is always "Section"':
|
|
'section.property: "Section"' in list_page,
|
|
"showSeparator hack removed from ConnectionListPage":
|
|
"showSeparator" not in list_page,
|
|
"ListItem.qml deleted":
|
|
not (root / "applet/contents/ui/ListItem.qml").exists(),
|
|
"onDeactivatedChanged separator hack removed from ConnectionItem":
|
|
"onDeactivatedChanged" not in item_page,
|
|
"sectionType() labels activating/active/deactivating as Connected":
|
|
all(s in section_fn for s in (
|
|
"Activating", "Activated", "Deactivating", '"Connected"',
|
|
)) and "Available connections" not in section_fn,
|
|
}
|
|
failed = [name for name, ok in checks.items() if not ok]
|
|
for name, ok in checks.items():
|
|
print(("PASS: " if ok else "FAIL: ") + name)
|
|
if failed:
|
|
print(f"\n{len(failed)} of {len(checks)} checks FAILED (bug is present)")
|
|
sys.exit(1)
|
|
print(f"\nAll {len(checks)} checks passed (bug 500674 fix present)")
|