"""Source-level guards only; these do not replace native macOS UI tests.""" from pathlib import Path import unittest ROOT = Path(__file__).resolve().parents[2] class CapturePanelContract(unittest.TestCase): def test_panel_has_no_financial_confirmation_path(self): source = (ROOT / 'app/src/capture_panel.rs').read_text() self.assertIn('MacosWindowConfig::floating_panel()', source) self.assertIn('start_capture_from_control(cx)', source) self.assertIn('cancel_capture_from_control(cx)', source) self.assertNotIn('desktop_confirm', source) self.assertNotIn('Review::new', source) self.assertNotIn('CaptureJob::start', source) def test_capture_hides_panel_before_starting_worker(self): source = (ROOT / 'app/src/desktop_capture_ui.rs').read_text() self.assertLess(source.index('set_capture_panel_visible(false)'), source.index('CaptureJob::start')) self.assertIn('if self.capture_job.is_some() || self.capture_review.is_some()', source) def test_platform_scope_and_native_host_only(self): shell = (ROOT / 'app/src/shell.rs').read_text() self.assertIn('#[cfg(target_os = "macos")]\n#[path = "capture_panel.rs"]', shell) native = (ROOT / 'budget-capture/src/sys/desktop/mod.rs').read_text() self.assertIn('window.orderOut(None)', native) self.assertIn('window.orderFrontRegardless()', native) if __name__ == '__main__': unittest.main()