Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a71021c7da | ||
|
|
30d347a393 |
No files matched your search
@@ -1,5 +1,16 @@
|
||||
# Arcade changelog
|
||||
|
||||
## 0.7.115
|
||||
|
||||
- Arcade opens correctly on Android instead of closing during startup.
|
||||
- Bundled offline games open with the full library installed.
|
||||
- The Android launcher icon fills its launcher shape with a larger gamepad.
|
||||
|
||||
## 0.7.114
|
||||
|
||||
- Apfelwurm Editor uses its painted logo cover in the library.
|
||||
- Tall library previews keep their titles visible in small, compressed cards.
|
||||
|
||||
## 0.7.113
|
||||
|
||||
- Choano 0.1.3 loads its artwork and sound from the paths the game requests.
|
||||
|
||||
@@ -54,6 +54,7 @@ run: all
|
||||
./build/arcade
|
||||
|
||||
test: all
|
||||
python3 tests/android_jni_contract_test.py
|
||||
python3 tests/game_updates_test.py
|
||||
$(ZIRAN) fmt --check src/*.zi apps/chess/*.zi tests/chess_engine_behavior.zi tests/chess_app_behavior.zi
|
||||
python3 tests/chess_locale_test.py
|
||||
|
||||
@@ -59,6 +59,11 @@ actions it
|
||||
cannot perform. Inbe supplies its own account and package policy.
|
||||
Arcade's launcher icon is MingCute's `game_2` gamepad (Apache-2.0).
|
||||
|
||||
An optional `artwork` mapping in `games.json` names a locked source-only
|
||||
dependency for a game's library pictures. Its paths still come from that
|
||||
game's declarations. This lets covers advance independently of playable
|
||||
code; the thumbnail source hashes remain checked when the catalog builds.
|
||||
|
||||
## One Chess game
|
||||
|
||||
Chess remains an installable app in Inner Breeze, where it also fits thoughtful
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
"arcade": {
|
||||
"id": "inbe.arcade",
|
||||
"title": "Arcade",
|
||||
"version": "0.7.113",
|
||||
"sequence": 192,
|
||||
"version": "0.7.115",
|
||||
"sequence": 194,
|
||||
"host_api": 41
|
||||
},
|
||||
"wurm": {
|
||||
|
||||
@@ -33,13 +33,13 @@
|
||||
"source_sha256": "96db251f36835c76cd03cd0104a6e1b5096e4c442d410960457edcd8e2377a38"
|
||||
},
|
||||
"wurm-editor-landscape": {
|
||||
"source_sha256": "670255e43a6fd232951fb3d1ce0d62d098d663230d731e7c447c44a944a907d3"
|
||||
"source_sha256": "b3616e68f1b391d1a4f9dd5d91538a63a889a7f977991e625831ec9caffa71c5"
|
||||
},
|
||||
"wurm-editor-portrait": {
|
||||
"source_sha256": "f3475185324e4f4bfa37561f09422546eab5595ab3887d26e684128b2ac9480b"
|
||||
"source_sha256": "07ff2ff0142c262cdcba3643bbc4d7d3d71643b7f9f4e678a910fee2bfd3eba1"
|
||||
},
|
||||
"wurm-editor-preview": {
|
||||
"source_sha256": "670255e43a6fd232951fb3d1ce0d62d098d663230d731e7c447c44a944a907d3"
|
||||
"source_sha256": "b3616e68f1b391d1a4f9dd5d91538a63a889a7f977991e625831ec9caffa71c5"
|
||||
},
|
||||
"wurm-landscape": {
|
||||
"source_sha256": "472773b7c106325e12777a81a29209496e22e0853782ca76955b6587824b1b30"
|
||||
|
||||
|
Before Width: | Height: | Size: 97 KiB After Width: | Height: | Size: 99 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 109 KiB |
|
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 114 KiB |
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 115 KiB |
@@ -52,6 +52,8 @@ public class ArcadeActivity extends NativeActivity {
|
||||
private native void nativeTextInputCommit(int codepoint);
|
||||
private native void nativeTextInputBackspace();
|
||||
private native void nativeTextInputEnter();
|
||||
// Registered by the locked Kryon host even when using key-event input.
|
||||
private native void nativeTextInputState(long target, long revision, byte[] value, int cursor, int anchor);
|
||||
private native int nativeSyncLifecycleState(boolean paused, boolean windowFocused);
|
||||
private native void nativeInvalidateGraphicsResources();
|
||||
// Kryon's android_picker: a picked file arrives as a private copy's path.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
{
|
||||
"packages": ["shovey", "wurm", "choano"]
|
||||
"packages": ["shovey", "wurm", "choano"],
|
||||
"artwork": {"wurm": "wurm_art"}
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background" />
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -16,6 +16,27 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
ABIS = ['arm64-v8a', 'armeabi-v7a']
|
||||
|
||||
|
||||
def verify_launcher(apk, tools, names):
|
||||
"""Resolve compiled resource IDs, including shortened release paths."""
|
||||
resources = subprocess.check_output(
|
||||
[str(tools / 'aapt'), 'dump', '--values', 'resources', str(apk)], text=True)
|
||||
entries = re.findall(r'resource (0x[0-9a-f]+) [^\n]+:(drawable/ic_launcher_\w+|mipmap/ic_launcher):[^\n]*\n\s*\(string8\) "([^"]+)"', resources)
|
||||
paths = {path for _, _, path in entries}
|
||||
assert paths <= set(names), 'A launcher resource is missing from the APK'
|
||||
legacy = [path for _, name, path in entries if name == 'mipmap/ic_launcher' and path.endswith('.png')]
|
||||
assert len(legacy) == 5, 'All five legacy icon densities must be present'
|
||||
adaptive = [path for _, name, path in entries if name == 'mipmap/ic_launcher' and path.endswith('.xml')]
|
||||
assert len(adaptive) == 1 and 'config anydpi-v26:' in resources, 'The Android adaptive icon is missing'
|
||||
layers = {name: identifier for identifier, name, _ in entries if name.startswith('drawable/')}
|
||||
tree = subprocess.check_output(
|
||||
[str(tools / 'aapt'), 'dump', 'xmltree', str(apk), adaptive[0]], text=True)
|
||||
assert 'E: adaptive-icon' in tree, 'The launcher XML is not adaptive'
|
||||
for layer in ('background', 'foreground'):
|
||||
identifier = layers.get('drawable/ic_launcher_' + layer)
|
||||
assert identifier and re.search(r'E: ' + layer + r'[^\n]*\n[^\n]*@' + identifier, tree), \
|
||||
f'The adaptive {layer} drawable is missing'
|
||||
|
||||
|
||||
def build_tools():
|
||||
sdk = Path(os.environ.get('ANDROID_SDK_ROOT') or os.environ.get('ANDROID_HOME') or Path.home() / 'Android/Sdk')
|
||||
folders = sorted((sdk / 'build-tools').glob('*'), key=lambda p: tuple(int(n) for n in re.findall(r'\d+', p.name)))
|
||||
@@ -31,7 +52,7 @@ def verify(apk, version, tools, edition='direct'):
|
||||
assert package and package[1] == 'xyz.waozi.arcade' and package[3] == version, 'APK identity or version differs'
|
||||
assert "application-label:'Arcade'" in badging, 'The APK is not labelled Arcade'
|
||||
# Release builds shorten resource names; the manifest names the icon.
|
||||
icon = re.search(r"^application: label='Arcade' icon='(res/[^']+\.png)'", badging, re.M)
|
||||
icon = re.search(r"^application: label='Arcade' icon='(res/[^']+\.(?:png|xml))'", badging, re.M)
|
||||
assert icon, "Arcade's launcher icon is missing"
|
||||
assert 'application-debuggable' not in badging, 'A debug build cannot be published'
|
||||
google_play = edition == 'gplay'
|
||||
@@ -48,6 +69,8 @@ def verify(apk, version, tools, edition='direct'):
|
||||
abis = sorted(p.split('/')[1] for p in names if re.fullmatch(r'lib/[^/]+/libmain\.so', p))
|
||||
assert abis == ABIS, 'Both supported ARM architectures must be present'
|
||||
assert icon[1] in names, "Arcade's launcher icon is missing"
|
||||
if tuple(map(int, version.split('.'))) >= (0, 7, 115):
|
||||
verify_launcher(apk, tools, names)
|
||||
metadata = json.loads(archive.read('assets/arcade.json'))
|
||||
payload = archive.read('assets/arcade.zx')
|
||||
assert metadata['id'] == 'inbe.arcade' and metadata['version'] == version
|
||||
|
||||
@@ -55,7 +55,9 @@ def stage_arcade():
|
||||
(assets / 'arcade.json').write_text(json.dumps(offline, indent=2) + '\n')
|
||||
# Android before 10 has no font lookup; the Windows build ships the same font.
|
||||
shutil.copyfile(package('kryon') / 'assets/fonts/LiberationSans-Regular.ttf', assets / 'kryon-font.ttf')
|
||||
launcher_icon(ROOT / 'site/icon-512.png', ROOT / 'build/android-res')
|
||||
launcher_icon(ROOT / 'site/android-launcher-512.png', ROOT / 'build/android-res')
|
||||
# Only Arcade gets this adaptive icon; standalone Shovey keeps its art.
|
||||
shutil.copytree(ROOT / 'packaging/android/icon-res', ROOT / 'build/android-res', dirs_exist_ok=True)
|
||||
return release
|
||||
|
||||
def stage_shovey():
|
||||
@@ -88,6 +90,8 @@ def main():
|
||||
parser.add_argument('--abis', default='arm64-v8a,armeabi-v7a', help='Native ABIs to build')
|
||||
parser.add_argument('--build-dir', type=Path, help='Separate Gradle and CMake output for verification')
|
||||
args = parser.parse_args()
|
||||
subprocess.run(['python3', str(ROOT / 'tests/android_jni_contract_test.py')],
|
||||
cwd=ROOT, check=True)
|
||||
arcade = args.product == 'arcade'
|
||||
if arcade and args.bundle:
|
||||
parser.error('Arcade builds APKs; the App Bundle is the standalone Shovey one')
|
||||
|
||||
@@ -80,7 +80,8 @@ def stage(root, controller, expected_controller_digest, output):
|
||||
bundle_bytes, preview_bytes = bundle.read_bytes(), preview.read_bytes()
|
||||
if not bundle_bytes or not preview_bytes:
|
||||
raise ValueError("Game bundles and previews must be built first")
|
||||
preview_bytes, preview_suffix = library_art(root, name, "preview", preview_bytes)
|
||||
preview_bytes, preview_suffix = library_art(root, name, "preview",
|
||||
(app["art_source"] / game["preview"]).read_bytes())
|
||||
total += len(bundle_bytes) + len(preview_bytes)
|
||||
child = dict(
|
||||
id=identifier, title=game["title"],
|
||||
@@ -112,7 +113,7 @@ def stage(root, controller, expected_controller_digest, output):
|
||||
relative = Path(cover[key])
|
||||
if relative.is_absolute() or ".." in relative.parts or relative.suffix not in {".png", ".jpg"}:
|
||||
raise ValueError("Invalid cover asset path")
|
||||
contents, suffix = library_art(root, name, key, (app["source"] / relative).read_bytes())
|
||||
contents, suffix = library_art(root, name, key, (app["art_source"] / relative).read_bytes())
|
||||
destination = Path("arcade/covers") / f"{name}-{key}{suffix}"
|
||||
packed_cover[key] = "assets/" + destination.as_posix()
|
||||
copies.append((contents, destination))
|
||||
|
||||
@@ -30,12 +30,19 @@ def relative_path(text):
|
||||
|
||||
def declared_packages(root, ziran=None, lock_flags=()):
|
||||
"""Arcade first, then each registered game package, with their apps."""
|
||||
names = ['self', *json.loads((Path(root) / 'games.json').read_text())['packages']]
|
||||
registration = json.loads((Path(root) / 'games.json').read_text())
|
||||
names = ['self', *registration['packages']]
|
||||
if len(set(names)) != len(names):
|
||||
raise ValueError('Duplicate game package')
|
||||
artwork = registration.get('artwork', {})
|
||||
if not isinstance(artwork, dict) or any(name not in names[1:] or
|
||||
not isinstance(alias, str) or not re.fullmatch(r'[A-Za-z_][A-Za-z0-9_]*', alias)
|
||||
for name, alias in artwork.items()):
|
||||
raise ValueError('Invalid artwork package')
|
||||
packages = []
|
||||
for name in names:
|
||||
source = package_root(root, name, ziran, lock_flags)
|
||||
art_source = package_root(root, artwork[name], ziran, lock_flags) if name in artwork else source
|
||||
declaration = json.loads((source / 'apps.json').read_text())
|
||||
apps = []
|
||||
for app in declaration['apps']:
|
||||
@@ -61,7 +68,7 @@ def declared_packages(root, ziran=None, lock_flags=()):
|
||||
not re.fullmatch(r'[A-Za-z_][A-Za-z0-9_]*:[A-Za-z_][A-Za-z0-9_]*', item)
|
||||
for item in library_entries) or len(set(library_entries)) != len(library_entries):
|
||||
raise ValueError(f'{name}: invalid portable library entries')
|
||||
apps.append(dict(package=name, source=source, manifest=manifest,
|
||||
apps.append(dict(package=name, source=source, art_source=art_source, manifest=manifest,
|
||||
descriptor=json.loads(manifest.read_text()),
|
||||
cover=app.get('cover'), requires=requires, shared_code=shared_code,
|
||||
shared_records=shared_records,
|
||||
|
||||
@@ -42,6 +42,11 @@ def small_copy(data, key):
|
||||
"""(bytes, suffix) of the library's copy of one picture."""
|
||||
image = Image.open(io.BytesIO(data))
|
||||
image.load()
|
||||
# The shared library cards are 2:3. Keep the top of taller paintings,
|
||||
# where their title lives, rather than letting the card centre-crop it.
|
||||
# Originals remain untouched; this framing belongs to the thumbnail.
|
||||
if key == 'portrait' and image.height > image.width * 1.5:
|
||||
image = image.crop((0, 0, image.width, round(image.width * 1.5)))
|
||||
longest = PREVIEW_LONGEST if key == 'preview' else LOGO_LONGEST if key == 'logo' else COVER_LONGEST
|
||||
scale = min(1.0, longest / max(image.size))
|
||||
alpha = 'A' in image.getbands() or 'transparency' in image.info
|
||||
@@ -72,10 +77,10 @@ def art(root=ROOT):
|
||||
if not app['enabled']:
|
||||
continue
|
||||
name = app['descriptor']['name']
|
||||
yield name, 'preview', (app['source'] / app['descriptor']['preview']).read_bytes()
|
||||
yield name, 'preview', (app['art_source'] / app['descriptor']['preview']).read_bytes()
|
||||
for key in ('portrait', 'landscape', 'logo'):
|
||||
if app['cover'] and key in app['cover']:
|
||||
yield name, key, (app['source'] / app['cover'][key]).read_bytes()
|
||||
yield name, key, (app['art_source'] / app['cover'][key]).read_bytes()
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
|
After Width: | Height: | Size: 20 KiB |
@@ -511,6 +511,13 @@ CollectionOpen :: (bundle: string, digest: string, harness_digest: string,
|
||||
}
|
||||
collection_ready = AppHostStart(*collection_host, bundle, "arcade.local", "inbe.arcade",
|
||||
"arcade", digest, "local", platform, harness_digest, locale)
|
||||
// The offline collection already contains every game's payload. Keep the
|
||||
// ordinary bounded game budget available in addition to that resident
|
||||
// collection; otherwise its packed bytes consume the game's allowance
|
||||
// before the first game opens. AppHostStart bounds the root to 64 MiB.
|
||||
if collection_ready && packed {
|
||||
collection_host.tree.byte_limit = APP_HOST_BYTE_LIMIT + bundle.count
|
||||
}
|
||||
if !collection_ready { Report("Arcade: the shared Apps host refused the collection") }
|
||||
return collection_ready
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
"""Every native registered on ArcadeActivity must exist with its JNI signature.
|
||||
|
||||
Android rejects the entire library in JNI_OnLoad when even one method is
|
||||
missing. Check the resolved host, so a package update cannot silently ship
|
||||
an activity that crashes before onCreate.
|
||||
"""
|
||||
from pathlib import Path
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def verify():
|
||||
kryon = Path(subprocess.check_output(
|
||||
[str(ROOT / 'scripts/ziran.sh'), 'pkg', 'path', 'kryon'],
|
||||
cwd=ROOT, text=True).strip())
|
||||
host = (kryon / 'src/backend/android_device.zi').read_text()
|
||||
glue = (ROOT / 'src/android_glue.zi').read_text()
|
||||
java = (ROOT / 'droid/app/src/main/java/xyz/waozi/arcade/ArcadeActivity.java').read_text()
|
||||
types = {'void': 'V', 'int': 'I', 'long': 'J', 'boolean': 'Z',
|
||||
'float': 'F', 'byte[]': '[B', 'String': 'Ljava/lang/String;'}
|
||||
declared = {}
|
||||
for result, name, arguments in re.findall(
|
||||
r'native\s+(\w+)\s+(\w+)\(([^)]*)\)', java):
|
||||
parameters = [argument.strip().split()[0] for argument in arguments.split(',') if argument.strip()]
|
||||
declared[name] = '(' + ''.join(types[t] for t in parameters) + ')' + types[result]
|
||||
registered = 0
|
||||
for source in (host, glue):
|
||||
names = dict((index, name) for name, index in re.findall(
|
||||
r'CopyCString\("(native\w+)", names\[(\d+)\]', source))
|
||||
signatures = dict((index, signature) for signature, index in re.findall(
|
||||
r'CopyCString\("([^"]+)", signatures\[(\d+)\]', source))
|
||||
for index, name in names.items():
|
||||
expected = signatures[index]
|
||||
assert declared.get(name) == expected, (
|
||||
f'{name}{expected} registered by native host, Java declares {declared.get(name)}')
|
||||
registered += 1
|
||||
assert registered >= 12, 'No Android JNI registration contract found'
|
||||
print(f'Android JNI contract: {registered} registered methods match ArcadeActivity')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
verify()
|
||||
@@ -71,11 +71,27 @@ with tempfile.TemporaryDirectory(prefix='arcade-offline-') as temporary:
|
||||
driver.wait_gone(label=LEVEL_UPDATES, role='text')
|
||||
if [node for node in driver.tree() if str(node.get('label', '')).startswith('Level 1 / ')]:
|
||||
break
|
||||
assert not driver.find(label='Request rejected'), 'The packed host rejected its game'
|
||||
assert time.monotonic() < deadline, 'Shovey did not start from the packed collection'
|
||||
time.sleep(0.05)
|
||||
if driver.find(label='How do you want to move?', role='text'):
|
||||
driver.press(label='Swipe and tap')
|
||||
driver.wait_gone(label='How do you want to move?', role='text')
|
||||
driver.press(label='Back', role='button')
|
||||
# Shared-code dependencies and the larger standalone game must
|
||||
# also fit while the full offline collection remains resident.
|
||||
for title, marker, role in [('Shovey Editor', 'New level', 'text'),
|
||||
('Apfelwurm', 'Play', 'button')]:
|
||||
driver.wait(label=title, role='button')
|
||||
driver.press(label=title, role='button')
|
||||
driver.wait(label=marker, role=role, timeout=60)
|
||||
assert not driver.find(label='Request rejected')
|
||||
assert not driver.find(label='Download', role='button')
|
||||
driver.key('escape')
|
||||
driver.wait(label='Shovey', role='button')
|
||||
assert not list((profile / 'resources').rglob('*.zx')), 'Nothing may be downloaded'
|
||||
finally:
|
||||
if child.poll() is None:
|
||||
child.terminate()
|
||||
child.wait(timeout=10)
|
||||
print('The Android collection opens every game and its art offline')
|
||||
print('The Android collection draws its art and opens Shovey, its shared-code editor and Apfelwurm offline')
|
||||
@@ -149,6 +149,10 @@ class CollectionTests(unittest.TestCase):
|
||||
(library / "sources.json").write_text(json.dumps(sources))
|
||||
|
||||
def stage_four_leaf_wurm_fixture(self):
|
||||
registration = self.root / 'games.json'
|
||||
value = json.loads(registration.read_text())
|
||||
value.pop('artwork', None)
|
||||
registration.write_text(json.dumps(value))
|
||||
source = self.root / "fixture-packages/wurm"
|
||||
(source / "editor").mkdir(parents=True)
|
||||
(source / "assets").mkdir()
|
||||
@@ -260,6 +264,26 @@ class CollectionTests(unittest.TestCase):
|
||||
with self.assertRaisesRegex(ValueError, "wurm-portrait art changed"):
|
||||
self.stage()
|
||||
|
||||
def test_artwork_input_changes_no_game_payload_or_version(self):
|
||||
packages = builder.declared_packages(self.root)
|
||||
game = next(app for package in packages for app in package['apps']
|
||||
if app['descriptor']['name'] == 'wurm-editor')
|
||||
self.assertNotEqual(game['source'], game['art_source'])
|
||||
self.assertEqual(hashlib.sha256((game['art_source'] / game['cover']['portrait']).read_bytes()).hexdigest(),
|
||||
'07ff2ff0142c262cdcba3643bbc4d7d3d71643b7f9f4e678a910fee2bfd3eba1')
|
||||
catalog = self.stage()
|
||||
child = next(item for item in catalog['children'] if item['expected_id'] == 'wurm-editor')
|
||||
self.assertEqual(child['version'], '0.1.0')
|
||||
self.assertEqual(child['sha256'], builder.digest(self.root / 'build/games/wurm-editor.zx'))
|
||||
|
||||
def test_artwork_override_must_name_a_registered_game(self):
|
||||
path = self.root / 'games.json'
|
||||
value = json.loads(path.read_text())
|
||||
value['artwork'] = {'unknown-game': 'wurm_art'}
|
||||
path.write_text(json.dumps(value))
|
||||
with self.assertRaisesRegex(ValueError, 'Invalid artwork package'):
|
||||
self.stage()
|
||||
|
||||
def test_every_library_cover_uses_a_bounded_thumbnail(self):
|
||||
catalog, packages = builder.stage(self.root, self.controller, self.controller_digest, self.output)
|
||||
children = {child['id']: child for child in catalog['children']}
|
||||
@@ -271,7 +295,7 @@ class CollectionTests(unittest.TestCase):
|
||||
for key in ('portrait', 'landscape', 'logo'):
|
||||
if key not in app['cover']:
|
||||
continue
|
||||
original = (app['source'] / app['cover'][key]).read_bytes()
|
||||
original = (app['art_source'] / app['cover'][key]).read_bytes()
|
||||
with self.subTest(app=child['id'], image=key):
|
||||
with Image.open(io.BytesIO(original)) as source:
|
||||
with Image.open(self.output / child['cover'][key]) as thumbnail:
|
||||
@@ -279,8 +303,11 @@ class CollectionTests(unittest.TestCase):
|
||||
self.assertLessEqual(max(thumbnail.size), limit)
|
||||
self.assertLessEqual(thumbnail.width, source.width)
|
||||
self.assertLessEqual(thumbnail.height, source.height)
|
||||
expected_ratio = source.width / source.height
|
||||
if key == 'portrait':
|
||||
expected_ratio = max(2 / 3, expected_ratio)
|
||||
self.assertAlmostEqual(thumbnail.width / thumbnail.height,
|
||||
source.width / source.height, delta=0.01)
|
||||
expected_ratio, delta=0.01)
|
||||
self.assertIn(thumbnail.mode, ('RGB', 'RGBA'))
|
||||
# Opaque cover art is a JPEG; transparency stays PNG.
|
||||
self.assertEqual(thumbnail.format, 'JPEG' if key != 'logo' and
|
||||
@@ -431,6 +458,21 @@ class CollectionTests(unittest.TestCase):
|
||||
|
||||
|
||||
class LibraryThumbnailTests(unittest.TestCase):
|
||||
def test_tall_portrait_keeps_title_inside_the_library_card(self):
|
||||
source = Image.new('RGB', (800, 1600), (25, 50, 75))
|
||||
source.paste((220, 180, 40), (80, 100, 720, 220))
|
||||
data = io.BytesIO()
|
||||
source.save(data, 'PNG')
|
||||
contents, suffix = artist.small_copy(data.getvalue(), 'portrait')
|
||||
self.assertEqual(suffix, '.jpg')
|
||||
with Image.open(io.BytesIO(contents)) as thumbnail:
|
||||
self.assertEqual(thumbnail.size, (427, 640))
|
||||
# The real card's centred cover fit now leaves the title intact.
|
||||
red, green, blue = thumbnail.getpixel((213, 85))
|
||||
self.assertGreater(red, 200)
|
||||
self.assertGreater(green, 160)
|
||||
self.assertLess(blue, 60)
|
||||
|
||||
def test_cover_keeps_full_colour_at_thumbnail_resolution(self):
|
||||
source = Image.new('RGB', (900, 1200))
|
||||
source.putdata([(x % 256, y % 256, (x + y) % 256)
|
||||
|
||||
@@ -192,6 +192,15 @@
|
||||
"ref": "d32e4b606ece83e8869c954f66c334f44f7b4838",
|
||||
"url": "https://github.com/kryonlabs/game2d.git"
|
||||
},
|
||||
{
|
||||
"commit": "2fa52f64eb0c29e8351b437176e896b938ece8e8",
|
||||
"dependencies": {},
|
||||
"id": "pef8c9ab30363ef38",
|
||||
"name": "wurm_art",
|
||||
"ref": "2fa52f64eb0c29e8351b437176e896b938ece8e8",
|
||||
"source": true,
|
||||
"url": "https://github.com/waozixyz/wurm.git"
|
||||
},
|
||||
{
|
||||
"commit": "cee04692f3461dcb098833472f071c434980debb",
|
||||
"dependencies": {"kryon": "p43481d12b77897ce"},
|
||||
@@ -202,7 +211,7 @@
|
||||
}
|
||||
],
|
||||
"root": {
|
||||
"dependencies": {"apps": "p6a59d2d6364debd6", "choano": "pba7b4d6a4dcf84ae", "entity": "pb6d17ac2aeb5844f", "game2d": "pe878ed78ee9f8300", "inbe": "p183b01bccc6424e7", "kryon": "p43481d12b77897ce", "mingcute": "pe1027b9d16704793", "shovey": "p1b5832789c5a5053", "wurm": "pb4256918f4b7855d"},
|
||||
"dependencies": {"apps": "p6a59d2d6364debd6", "choano": "pba7b4d6a4dcf84ae", "entity": "pb6d17ac2aeb5844f", "game2d": "pe878ed78ee9f8300", "inbe": "p183b01bccc6424e7", "kryon": "p43481d12b77897ce", "mingcute": "pe1027b9d16704793", "shovey": "p1b5832789c5a5053", "wurm": "pb4256918f4b7855d", "wurm_art": "pef8c9ab30363ef38"},
|
||||
"name": "Arcade"
|
||||
},
|
||||
"toolchain": {
|
||||
|
||||
@@ -65,3 +65,9 @@ ref = "d32e4b606ece83e8869c954f66c334f44f7b4838"
|
||||
[dependencies.choano]
|
||||
git = "https://github.com/waozixyz/choano.git"
|
||||
ref = "528618898db605b0f2960759d49871cde2209086"
|
||||
|
||||
# Library art can advance independently of the tested game payload.
|
||||
[dependencies.wurm_art]
|
||||
git = "https://github.com/waozixyz/wurm.git"
|
||||
ref = "2fa52f64eb0c29e8351b437176e896b938ece8e8"
|
||||
source = true
|
||||