Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

README: seven themes ship, not five

xbsheng3c419625b148
diff --git a/README.md b/README.md
index 8d4df1df3..604f0ceb7 100644
--- a/README.md
+++ b/README.md
@@ -491,7 +491,7 @@ The **TV** needs Android 8.0 (API 26) or newer: `minSdk` is a compile-time floor
|---|---|
| **Configure** | Dock order, hidden apps, Live TV app, 4 to 7 tiles per row, reduced motion. All in [`config.xml`](launcher/app/src/main/res/values/config.xml) |
| **Settings on the TV** | Hold OK on Settings for launcher settings. Optional `launcher_settings_button` makes a normal click open them directly; TV settings remain on the settings page and their app tile. |
-| **Themes** | Background, wallpaper and layout from a `config.json` pushed over Wi-Fi, no rebuild. Five ship in [`themes/`](themes/) |
+| **Themes** | Background, wallpaper and layout from a `config.json` pushed over Wi-Fi, no rebuild. Seven ship in [`themes/`](themes/), the built-in `default/` included |
| **25 languages** | Follows the TV's language, with a fully mirrored right-to-left layout for Hebrew |
| **App library** | Optional: browse every installed app and add or remove Home shortcuts. See [the app library guide](docs/app-library.md) |
| **Tile menu** | Optional (`tile_menu`): hold OK on a tile for Move, Remove from Home and App info. Off, holding OK opens App info |
diff --git a/tests/test_readme_theme_count.py b/tests/test_readme_theme_count.py
new file mode 100644
index 000000000..4ffe77ee4
--- /dev/null
+++ b/tests/test_readme_theme_count.py
@@ -0,0 +1,108 @@
+"""The front page's theme count matches the themes/ folder.
+
+README.md's feature table answers "what can I get without a rebuild?" with a themes row, and that
+row carries a number: "Five ship in themes/". The number is a claim about the tree, and nothing read
+it: it was written when themes/ held five folders (aurora, default, dussehra, scenes, six-columns)
+and stayed at five while glass and ruska were added, so the page offered a reader two fewer looks
+than the repo ships.
+
+A theme folder is one with a config.json - the same rule tests/test_themes.py uses, and the same one
+the launcher pushes (tools/theme.sh reads a folder's config.json). The number in the row is read
+from the page, never copied here, so a third theme cannot land without the sentence following.
+
+Run from the repository root: python3 -m unittest discover -s tests -v
+"""
+import re
+from pathlib import Path
+import tempfile
+import unittest
+
+
+ROOT = Path(__file__).resolve().parents[1]
+THEMES = ROOT / "themes"
+FRONT = ROOT / "README.md"
+
+# The row is `| **Themes** | ... N ship in [`themes/`](themes/)`. A count written as a word or as
+# digits is accepted, so rewording the cell stays free as long as the number is still there.
+ROW_START = "| **Themes** |"
+COUNT = re.compile(r"\b(\d+|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)\s+ship\b",
+ re.IGNORECASE)
+WORDS = {
+ "one": 1, "two": 2, "three": 3, "four": 4, "five": 5, "six": 6,
+ "seven": 7, "eight": 8, "nine": 9, "ten": 10, "eleven": 11, "twelve": 12,
+}
+
+
+def themes_row(text):
+ """The README feature row for themes, or None when the page has no such row."""
+ for line in text.split("\n"):
+ if line.startswith(ROW_START):
+ return line
+ return None
+
+
+def count_in(row):
+ """The number the row claims, or None when it claims none."""
+ if row is None:
+ return None
+ match = COUNT.search(row)
+ if match is None:
+ return None
+ token = match.group(1).lower()
+ return int(token) if token.isdigit() else WORDS[token]
+
+
+def theme_folders(root=THEMES):
+ """Every folder in themes/ that carries a config.json, i.e. every pushable theme."""
+ if not root.is_dir():
+ return []
+ return sorted(p.name for p in root.iterdir() if p.is_dir() and (p / "config.json").is_file())
+
+
+class ReadmeThemeCountTest(unittest.TestCase):
+ def test_the_count_names_every_theme(self):
+ row = themes_row(FRONT.read_text(encoding="utf-8"))
+ self.assertIsNotNone(row, "README.md has no `| **Themes** |` feature row any more")
+ claimed = count_in(row)
+ self.assertIsNotNone(claimed, f"the Themes row states no count: {row}")
+ shipped = theme_folders()
+ # Named in the failure so whoever added a theme knows which line to change.
+ self.assertEqual(
+ claimed, len(shipped),
+ f"the Themes row says {claimed} and themes/ holds {len(shipped)}: {', '.join(shipped)}")
+
+
+class CountTest(unittest.TestCase):
+ """The readers above, so the repo-wide test cannot pass by finding nothing."""
+
+ def test_a_word_is_read(self):
+ self.assertEqual(5, count_in("| **Themes** | ... Five ship in [`themes/`](themes/) |"))
+
+ def test_digits_are_read(self):
+ self.assertEqual(7, count_in("| **Themes** | ... 7 ship in [`themes/`](themes/) |"))
+
+ def test_a_row_without_a_count_reads_as_none(self):
+ self.assertEqual(None, count_in("| **Themes** | Layout from a pushed `config.json` |"))
+
+ def test_a_missing_row_reads_as_none(self):
+ self.assertEqual(None, count_in(themes_row("| **Configure** | Dock order |\n")))
+ self.assertEqual(None, count_in(themes_row("")))
+
+ def test_the_row_is_found_among_other_rows(self):
+ text = ("| **Configure** | Dock order |\n"
+ "| **Themes** | ... Six ship in [`themes/`](themes/) |\n"
+ "| **25 languages** | Follows the TV's language |\n")
+ self.assertEqual(6, count_in(themes_row(text)))
+
+ def test_only_folders_with_a_config_count(self):
+ with tempfile.TemporaryDirectory() as tmp:
+ root = Path(tmp)
+ (root / "aurora").mkdir()
+ (root / "aurora" / "config.json").write_text("{}", encoding="utf-8")
+ (root / "wallpapers").mkdir() # a picture dump, not a theme
+ (root / "README.md").write_text("not a folder", encoding="utf-8")
+ self.assertEqual(["aurora"], theme_folders(root))
+
+
+if __name__ == "__main__":
+ unittest.main()