From 71bfc9378616572bb72b31caae994cc4b3a171e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Tue, 6 Oct 2026 00:51:52 -0400 Subject: [PATCH] =?UTF-8?q?Lib=20=C2=B7=20init=5Ffor=5Ftests:=20theme=20an?= =?UTF-8?q?d=20key=20bindings=20without=20assets,=20so=20apps=20can=20rend?= =?UTF-8?q?er=20Ely=20components=20in=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 0046751..94c2173 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -59,6 +59,17 @@ pub fn init(cx: &mut App) { Err(error) => panic!("ely: asset source failed: {error:#}"), } assets::load_fonts(cx).expect("ely: embedded fonts failed to register"); + setup(cx); +} + +/// `init` without assets or fonts, for app tests that render. +#[cfg(any(test, feature = "test-support"))] +pub fn init_for_tests(cx: &mut App) { + setup(cx); +} + +/// The theme and key bindings. +fn setup(cx: &mut App) { theme::Theme::init(cx); cx.bind_keys([ KeyBinding::new("tab", FocusNext, None),