mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 05:02:50 +02:00
Store: unknown VR counts as flat; browse keeps unknown-fit VR first
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
69f790b83a
commit
ea73145fbc
2 files changed
+15
-2
No files matched your search
@@ -51,6 +51,18 @@ class SearchTests(SettingsTest):
|
|||||||
self.assertEqual(len(search.group(ENTRIES, vr=False)), 1)
|
self.assertEqual(len(search.group(ENTRIES, vr=False)), 1)
|
||||||
self.assertEqual(len(search.group(ENTRIES, installable=True)), 1)
|
self.assertEqual(len(search.group(ENTRIES, installable=True)), 1)
|
||||||
|
|
||||||
|
def test_unknown_vr_counts_as_flat(self):
|
||||||
|
entries = [dict(ENTRIES[3], id='a', name='Flat', vr=False), dict(ENTRIES[3], id='b', name='Unknown', vr=None),
|
||||||
|
dict(ENTRIES[3], id='c', name='Headset', vr=True)]
|
||||||
|
self.assertEqual(sorted(a['name'] for a in search.group(entries, vr=False)), ['Flat', 'Unknown'])
|
||||||
|
self.assertEqual([a['name'] for a in search.group(entries, vr=True)], ['Headset'])
|
||||||
|
|
||||||
|
def test_browse_puts_unknown_fit_vr_first_and_blocked_last(self):
|
||||||
|
entries = [dict(source='s', id='flat', name='Flat', package='a.flat', vr=False, min_sdk=21, abis=[]),
|
||||||
|
dict(source='s', id='vr', name='Headset', package='a.vr', vr=True),
|
||||||
|
dict(source='s', id='bad', name='Blocked', package='a.bad', vr=True, min_sdk=34, abis=[])]
|
||||||
|
self.assertEqual([a['name'] for a in search.group(entries)], ['Headset', 'Flat', 'Blocked'])
|
||||||
|
|
||||||
def test_fit_unknown_and_native_free_and_vr_hints(self):
|
def test_fit_unknown_and_native_free_and_vr_hints(self):
|
||||||
self.assertIsNone(search.fit({})['installable'])
|
self.assertIsNone(search.fit({})['installable'])
|
||||||
self.assertTrue(search.fit({'min_sdk': 23, 'abis': []})['installable'])
|
self.assertTrue(search.fit({'min_sdk': 23, 'abis': []})['installable'])
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ def group(entries, query='', vr=None, installable=False):
|
|||||||
groups = {}
|
groups = {}
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
entry = decorate(entry)
|
entry = decorate(entry)
|
||||||
if vr is not None and entry.get('vr') is not vr:
|
if vr is not None and (entry.get('vr') is True) != vr: # unknown counts as flat
|
||||||
continue
|
continue
|
||||||
if installable and entry['fit']['installable'] is not True:
|
if installable and entry['fit']['installable'] is not True:
|
||||||
continue
|
continue
|
||||||
@@ -196,7 +196,8 @@ def group(entries, query='', vr=None, installable=False):
|
|||||||
return (o.get('vr') is not True, not art.get('banner'), not art.get('screenshots'),
|
return (o.get('vr') is not True, not art.get('banner'), not art.get('screenshots'),
|
||||||
''.join(chr(0x10ffff - ord(c)) for c in str(o.get('updated') or '')))
|
''.join(chr(0x10ffff - ord(c)) for c in str(o.get('updated') or '')))
|
||||||
if not q:
|
if not q:
|
||||||
result.sort(key=lambda a: (not any(o['fit']['installable'] is True for o in a['offers']),) + browse(a))
|
# Unknown fit stays in the VR-first order; only apps known not to install sink.
|
||||||
|
result.sort(key=lambda a: (all(o['fit']['installable'] is False for o in a['offers']),) + browse(a))
|
||||||
return result
|
return result
|
||||||
result.sort(key=lambda a: (not any(normalise(o.get('name')) == q for o in a['offers']),
|
result.sort(key=lambda a: (not any(normalise(o.get('name')) == q for o in a['offers']),
|
||||||
not any(o['fit']['installable'] is True for o in a['offers']),
|
not any(o['fit']['installable'] is True for o in a['offers']),
|
||||||
|
|||||||
Reference in new issue
Block a user