Streak widget from 1x1 to 4x4 with an animated flame (orange while lit, grey when not), a streak keeper that writes the chosen message once a day to the chosen chats (off until switched on), avatar shapes, widgets and the keeper kept per account, Material 3 tonal surfaces instead of black (AMOLED keeps pure black), launcher previews of our own, and the mod runtime in a dex of its own. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
59 lines
2.1 KiB
Python
59 lines
2.1 KiB
Python
"""Run the "what is black" rule of the tonal-surface skin on a real JVM."""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import shutil
|
|
import subprocess
|
|
import tempfile
|
|
import unittest
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
SOURCE = ROOT / "src" / "lihont" / "two" / "look" / "BlackRule.java"
|
|
HARNESS = ROOT / "tests" / "java" / "lihont" / "two" / "look" / "BlackRuleTest.java"
|
|
|
|
|
|
class BlackRuleTest(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.javac = shutil.which("javac")
|
|
cls.java = shutil.which("java")
|
|
if not cls.javac or not cls.java:
|
|
raise RuntimeError("Black rule tests require a JDK with java and javac")
|
|
cls.temporary = tempfile.TemporaryDirectory(prefix="lihont-black-tests-")
|
|
cls.addClassCleanup(cls.temporary.cleanup)
|
|
cls.classes = Path(cls.temporary.name) / "classes"
|
|
cls.classes.mkdir()
|
|
cls.environment = dict(os.environ)
|
|
cls.environment.pop("JAVA_TOOL_OPTIONS", None)
|
|
cls.run_command([
|
|
cls.javac, "--release", "17", "-encoding", "UTF-8", "-Xlint:all", "-Werror",
|
|
"-d", str(cls.classes), str(SOURCE), str(HARNESS),
|
|
])
|
|
|
|
@classmethod
|
|
def run_command(cls, command):
|
|
result = subprocess.run(command, capture_output=True, text=True, encoding="utf-8",
|
|
env=cls.environment, timeout=120)
|
|
if result.returncode:
|
|
raise AssertionError(f"Command failed with exit {result.returncode}: {command[0]}\n"
|
|
+ result.stdout + result.stderr)
|
|
return result
|
|
|
|
def run_scenario(self, name):
|
|
result = self.run_command([self.java, "-cp", str(self.classes), "lihont.two.look.BlackRuleTest", name])
|
|
self.assertEqual(result.stdout.strip(), "PASS " + name)
|
|
|
|
def test_black_and_almost_black(self):
|
|
self.run_scenario("black")
|
|
|
|
def test_scrims_greys_and_colours_are_left_alone(self):
|
|
self.run_scenario("notBlack")
|
|
|
|
def test_the_skin_does_not_repaint_its_own_colours(self):
|
|
self.run_scenario("surfaces")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|