mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 02:53:41 +08:00
Align saved AOL preference and Galaxy test fixtures
This commit is contained in:
@@ -94,7 +94,8 @@ class SettingsGatewayTest(unittest.TestCase):
|
||||
self.context.value = context
|
||||
page = self.page('aol')
|
||||
index = next(i for i, row in enumerate(page['rows']) if row['label'] == 'Enable Always On Lateral')
|
||||
self.assertFalse(page['rows'][index]['available'])
|
||||
self.assertTrue(page['rows'][index]['available'])
|
||||
self.assertFalse(policy_for(cp).runtime_supported)
|
||||
|
||||
def test_enabled_aol_can_be_disabled_without_supported_vehicle(self):
|
||||
self.params.put('AlwaysOnLateral', True, block=True)
|
||||
@@ -105,8 +106,14 @@ class SettingsGatewayTest(unittest.TestCase):
|
||||
intent = self.gateway.preview(page['view'], index, 0, self.session, self.generation, value='Off')
|
||||
self.assertTrue(self.gateway.confirm(intent['intent'], self.session, self.generation))
|
||||
self.assertFalse(self.params.get_bool('AlwaysOnLateral'))
|
||||
row = next(row for row in self.page('aol')['rows'] if row['label'] == 'Enable Always On Lateral')
|
||||
self.assertFalse(row['available'], 'Enabling still requires an actual supported capability')
|
||||
page = self.page('aol')
|
||||
row = next(row for row in page['rows'] if row['label'] == 'Enable Always On Lateral')
|
||||
self.assertTrue(row['available'], 'The master saves intent independently of vehicle admission')
|
||||
intent = self.gateway.preview(page['view'], index, 0, self.session, self.generation, value='On')
|
||||
self.assertTrue(self.gateway.confirm(intent['intent'], self.session, self.generation))
|
||||
self.assertTrue(self.params.get_bool('AlwaysOnLateral'))
|
||||
from openpilot.starpilot.aol.vehicle import policy_for
|
||||
self.assertFalse(policy_for(None).runtime_supported)
|
||||
|
||||
def test_aol_off_rechecks_session_authority_after_parameter_lock(self):
|
||||
self.params.put('AlwaysOnLateral', True, block=True)
|
||||
|
||||
@@ -36,7 +36,7 @@ function buttons(node) {
|
||||
if (!node || typeof node !== "object") return []
|
||||
return [...(node.type === "button" ? [node] : []), ...(Array.isArray(node.children) ? node.children.flatMap(buttons) : [])]
|
||||
}
|
||||
const context = { row, index: 2, control: "switch", currentValue: "Off", dimmed: false, locked: false, busy: false, updating: false,
|
||||
const context = { compact: false, row, index: 2, control: "switch", currentValue: "Off", dimmed: false, locked: false, busy: false, updating: false,
|
||||
showDefault: true, onSwitch: () => {}, $emit: (...args) => events.push(args) }
|
||||
const events = []
|
||||
const button = buttons(render(context, [])).find(node => node.children === "Default")
|
||||
|
||||
@@ -4,7 +4,11 @@ import { PlotsPage } from '../web/js/plots.js'
|
||||
import { SettingsFeed } from '../web/js/settings.js'
|
||||
import { SURFACE_GROUPS } from '../web/js/flm-training-results.js'
|
||||
|
||||
const vm = { ...FlmPage.data(), activePage: true, mode: 'local', unauthorized() {} }
|
||||
const vm = { $nextTick: callback => {
|
||||
const before = globalThis.document
|
||||
globalThis.document = { getElementById: () => null }
|
||||
try { callback() } finally { globalThis.document = before }
|
||||
}, ...FlmPage.data(), activePage: true, mode: 'local', unauthorized() {} }
|
||||
for (const [name, method] of Object.entries(FlmPage.methods)) vm[name] = method.bind(vm)
|
||||
for (const [name, method] of Object.entries(FlmPage.computed)) Object.defineProperty(vm, name, { get: () => method.call(vm) })
|
||||
const names = [...new Set(SURFACE_GROUPS.flatMap(group => group.names))]
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"protected_inventory_sha256": "3bc6a287c02f731e718684f58335d6be44cee2ca1fbbe45c1da902388ceb5a35", "schema_version": 1}
|
||||
{"protected_inventory_sha256": "2a750beaa582adfd456f257132ec3200f21bef7baf40527187ce408203197948", "schema_version": 1}
|
||||
|
||||
Reference in New Issue
Block a user