R8.1: document content keeps the file's colours in a dark app
Pages, cells, slides and PDF pages paint as the file says in any appearance; only the chrome around them follows dark mode. The kernel keeps Ely's one light scheme, sent once a view, and MuPDF no longer inverts. Reviews now run gpt-6.1-sol at xhigh. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
42 files changed
+204
-209
No files matched your search
@@ -1,6 +1,6 @@
|
||||
//! Password prompts, zoomed pairs, jumps across (C11.1).
|
||||
|
||||
use ely_office::{Dialog, Dialogs as _, Tabs as _};
|
||||
use ely_office::{Dialog, Dialogs as _, Opening as _, Tabs as _};
|
||||
use gpui::{Entity, Modifiers, ScrollDelta, ScrollWheelEvent, TestAppContext, VisualTestContext, point, px};
|
||||
|
||||
use super::{file, frames, settle, shown, windowed};
|
||||
@@ -144,3 +144,21 @@ fn ctrl_and_a_wheel_notch_step_the_zoom_once() {
|
||||
frames(cx);
|
||||
assert_eq!(read(cx).0, Zoom::Scale(crate::keys::stepped(1.0, false)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_dark_app_shows_the_page_as_the_file_paints_it() {
|
||||
use ely_gpui_component::theme::{Mode, Theme};
|
||||
let dir = tempfile::tempdir().expect("a temp dir");
|
||||
let mut cx = TestAppContext::single();
|
||||
let (viewer, cx) = windowed(&mut cx, dir.path(), &[], true);
|
||||
cx.update(|_, app| Theme::set_mode_now(Mode::Dark, app));
|
||||
let path = file(dir.path(), "one.pdf", &[(612.0, 792.0, &["alpha"])]);
|
||||
cx.update(|_, app| viewer.update(app, |viewer, cx| viewer.open_file(path, cx)));
|
||||
settle(cx, |app| viewer.read(app).active_view().is_some());
|
||||
let view = shown(cx, &viewer);
|
||||
let corner = |app: &gpui::App| view.read(app).tiles.iter().find(|(key, _)| key.tx == 0 && key.ty == 0).map(|(_, image)| image.clone());
|
||||
settle(cx, |app| corner(app).is_some());
|
||||
let tile = cx.update(|_, app| corner(app)).expect("the first tile");
|
||||
let bytes = tile.as_bytes(0).expect("its pixels");
|
||||
assert_eq!(&bytes[..3], &[255, 255, 255], "the paper stays white");
|
||||
}
|
||||
Reference in new issue
Block a user