winit-core: fix tests

This commit is contained in:
Kirill Chibisov 2025-05-03 21:35:32 +09:00
parent 634b9baea2
commit 9598eb371c
4 changed files with 22 additions and 22 deletions

View file

@ -51,10 +51,10 @@ impl From<CustomCursor> for Cursor {
/// # Example /// # Example
/// ///
/// ```no_run /// ```no_run
/// # use winit::event_loop::ActiveEventLoop; /// # use winit_core::event_loop::ActiveEventLoop;
/// # use winit::window::Window; /// # use winit_core::window::Window;
/// # fn scope(event_loop: &dyn ActiveEventLoop, window: &dyn Window) { /// # fn scope(event_loop: &dyn ActiveEventLoop, window: &dyn Window) {
/// use winit::window::CustomCursorSource; /// use winit_core::cursor::CustomCursorSource;
/// ///
/// let w = 10; /// let w = 10;
/// let h = 10; /// let h = 10;

View file

@ -752,8 +752,8 @@ pub struct KeyEvent {
/// done by ignoring events where this property is set. /// done by ignoring events where this property is set.
/// ///
/// ```no_run /// ```no_run
/// use winit::event::{ElementState, KeyEvent, WindowEvent}; /// use winit_core::event::{ElementState, KeyEvent, WindowEvent};
/// use winit::keyboard::{KeyCode, PhysicalKey}; /// use winit_core::keyboard::{KeyCode, PhysicalKey};
/// # let window_event = WindowEvent::RedrawRequested; // To make the example compile /// # let window_event = WindowEvent::RedrawRequested; // To make the example compile
/// match window_event { /// match window_event {
/// WindowEvent::KeyboardInput { /// WindowEvent::KeyboardInput {

View file

@ -1564,7 +1564,7 @@ impl NamedKey {
/// # wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); /// # wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
/// # #[cfg_attr(web_platform, wasm_bindgen_test::wasm_bindgen_test)] /// # #[cfg_attr(web_platform, wasm_bindgen_test::wasm_bindgen_test)]
/// # fn main() { /// # fn main() {
/// use winit::keyboard::NamedKey; /// use winit_core::keyboard::NamedKey;
/// ///
/// assert_eq!(NamedKey::Enter.to_text(), Some("\r")); /// assert_eq!(NamedKey::Enter.to_text(), Some("\r"));
/// assert_eq!(NamedKey::F20.to_text(), None); /// assert_eq!(NamedKey::F20.to_text(), None);
@ -1591,7 +1591,7 @@ impl Key {
/// # wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser); /// # wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
/// # #[cfg_attr(web_platform, wasm_bindgen_test::wasm_bindgen_test)] /// # #[cfg_attr(web_platform, wasm_bindgen_test::wasm_bindgen_test)]
/// # fn main() { /// # fn main() {
/// use winit::keyboard::{Key, NamedKey}; /// use winit_core::keyboard::{Key, NamedKey};
/// ///
/// assert_eq!(Key::Character("a".into()).to_text(), Some("a")); /// assert_eq!(Key::Character("a".into()).to_text(), Some("a"));
/// assert_eq!(Key::Named(NamedKey::Enter).to_text(), Some("\r")); /// assert_eq!(Key::Named(NamedKey::Enter).to_text(), Some("\r"));

View file

@ -581,7 +581,7 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// APIs and software rendering. /// APIs and software rendering.
/// ///
/// ```no_run /// ```no_run
/// # use winit::window::Window; /// # use winit_core::window::Window;
/// # fn swap_buffers() {} /// # fn swap_buffers() {}
/// # fn scope(window: &dyn Window) { /// # fn scope(window: &dyn Window) {
/// // Do the actual drawing with OpenGL. /// // Do the actual drawing with OpenGL.
@ -657,8 +657,8 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// This automatically un-maximizes the window if it's maximized. /// This automatically un-maximizes the window if it's maximized.
/// ///
/// ```no_run /// ```no_run
/// # use winit::dpi::{LogicalPosition, PhysicalPosition}; /// # use dpi::{LogicalPosition, PhysicalPosition};
/// # use winit::window::Window; /// # use winit_core::window::Window;
/// # fn scope(window: &dyn Window) { /// # fn scope(window: &dyn Window) {
/// // Specify the position in logical dimensions like this: /// // Specify the position in logical dimensions like this:
/// window.set_outer_position(LogicalPosition::new(400.0, 200.0).into()); /// window.set_outer_position(LogicalPosition::new(400.0, 200.0).into());
@ -715,8 +715,8 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// The request could automatically un-maximize the window if it's maximized. /// The request could automatically un-maximize the window if it's maximized.
/// ///
/// ```no_run /// ```no_run
/// # use winit::dpi::{LogicalSize, PhysicalSize}; /// # use dpi::{LogicalSize, PhysicalSize};
/// # use winit::window::Window; /// # use winit_core::window::Window;
/// # fn scope(window: &dyn Window) { /// # fn scope(window: &dyn Window) {
/// // Specify the size in logical dimensions like this: /// // Specify the size in logical dimensions like this:
/// let _ = window.request_surface_size(LogicalSize::new(400.0, 200.0).into()); /// let _ = window.request_surface_size(LogicalSize::new(400.0, 200.0).into());
@ -772,7 +772,7 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// Convert safe area insets to a size and a position. /// Convert safe area insets to a size and a position.
/// ///
/// ``` /// ```
/// use winit::dpi::{PhysicalPosition, PhysicalSize}; /// use dpi::{PhysicalPosition, PhysicalSize};
/// ///
/// # let surface_size = dpi::PhysicalSize::new(0, 0); /// # let surface_size = dpi::PhysicalSize::new(0, 0);
/// # #[cfg(requires_window)] /// # #[cfg(requires_window)]
@ -792,8 +792,8 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// Sets a minimum dimensions of the window's surface. /// Sets a minimum dimensions of the window's surface.
/// ///
/// ```no_run /// ```no_run
/// # use winit::dpi::{LogicalSize, PhysicalSize}; /// # use dpi::{LogicalSize, PhysicalSize};
/// # use winit::window::Window; /// # use winit_core::window::Window;
/// # fn scope(window: &dyn Window) { /// # fn scope(window: &dyn Window) {
/// // Specify the size in logical dimensions like this: /// // Specify the size in logical dimensions like this:
/// window.set_min_surface_size(Some(LogicalSize::new(400.0, 200.0).into())); /// window.set_min_surface_size(Some(LogicalSize::new(400.0, 200.0).into()));
@ -811,8 +811,8 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// Sets a maximum dimensions of the window's surface. /// Sets a maximum dimensions of the window's surface.
/// ///
/// ```no_run /// ```no_run
/// # use winit::dpi::{LogicalSize, PhysicalSize}; /// # use dpi::{LogicalSize, PhysicalSize};
/// # use winit::window::Window; /// # use winit_core::window::Window;
/// # fn scope(window: &dyn Window) { /// # fn scope(window: &dyn Window) {
/// // Specify the size in logical dimensions like this: /// // Specify the size in logical dimensions like this:
/// window.set_max_surface_size(Some(LogicalSize::new(400.0, 200.0).into())); /// window.set_max_surface_size(Some(LogicalSize::new(400.0, 200.0).into()));
@ -1071,8 +1071,8 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// ## Example /// ## Example
/// ///
/// ```no_run /// ```no_run
/// # use winit::dpi::{LogicalPosition, PhysicalPosition, LogicalSize, PhysicalSize}; /// # use dpi::{LogicalPosition, PhysicalPosition, LogicalSize, PhysicalSize};
/// # use winit::window::Window; /// # use winit_core::window::Window;
/// # fn scope(window: &dyn Window) { /// # fn scope(window: &dyn Window) {
/// // Specify the position in logical dimensions like this: /// // Specify the position in logical dimensions like this:
/// window.set_ime_cursor_area( /// window.set_ime_cursor_area(
@ -1214,8 +1214,8 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// Changes the position of the cursor in window coordinates. /// Changes the position of the cursor in window coordinates.
/// ///
/// ```no_run /// ```no_run
/// # use winit::dpi::{LogicalPosition, PhysicalPosition}; /// # use dpi::{LogicalPosition, PhysicalPosition};
/// # use winit::window::Window; /// # use winit_core::window::Window;
/// # fn scope(window: &dyn Window) { /// # fn scope(window: &dyn Window) {
/// // Specify the position in logical dimensions like this: /// // Specify the position in logical dimensions like this:
/// window.set_cursor_position(LogicalPosition::new(400.0, 200.0).into()); /// window.set_cursor_position(LogicalPosition::new(400.0, 200.0).into());
@ -1238,7 +1238,7 @@ pub trait Window: AsAny + Send + Sync + fmt::Debug {
/// First try confining the cursor, and if that fails, try locking it instead. /// First try confining the cursor, and if that fails, try locking it instead.
/// ///
/// ```no_run /// ```no_run
/// # use winit::window::{CursorGrabMode, Window}; /// # use winit_core::window::{CursorGrabMode, Window};
/// # fn scope(window: &dyn Window) { /// # fn scope(window: &dyn Window) {
/// window /// window
/// .set_cursor_grab(CursorGrabMode::Confined) /// .set_cursor_grab(CursorGrabMode::Confined)