{"record":{"id":"4088cd629ec3926f","repo":"slint-ui/slint","slug":"no-simulated-native-drag-in-flight","errorCode":null,"errorMessage":"no simulated native drag in flight","messagePattern":"no simulated native drag in flight","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/backends/testing/testing_backend.rs","lineNumber":416,"sourceCode":"    /// the final negotiated action.\n    pub fn simulate_native_drop(\n        &self,\n        target: &i_slint_core::api::Window,\n        position: LogicalPosition,\n    ) -> DragAction {\n        let action = self.deliver_native_drag(target, position, true);\n        WindowInner::from_pub(&self.window).report_drag_finished(action);\n        action\n    }\n\n    fn deliver_native_drag(\n        &self,\n        target: &i_slint_core::api::Window,\n        position: LogicalPosition,\n        drop: bool,\n    ) -> DragAction {\n        let (data, allowed) =\n            self.native_drag.borrow().clone().expect(\"no simulated native drag in flight\");\n        let mut event = DropEvent::default();\n        event.data = data;\n        event.position = position;\n        event.proposed_action =\n            i_slint_core::items::compute_proposed_action(Default::default(), allowed);\n        let event = if drop {\n            BackendDragEvent::Drop { event, allowed }\n        } else {\n            BackendDragEvent::Move { event, allowed }\n        };\n        WindowInner::from_pub(target).process_drag_event(event).unwrap_or(DragAction::None)\n    }\n}\n\nimpl WindowAdapterInternal for TestingWindow {\n    fn input_method_request(&self, request: i_slint_core::window::InputMethodRequest) {\n        self.ime_requests.borrow_mut().push(request)\n    }","sourceCodeStart":398,"sourceCodeEnd":434,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/internal/backends/testing/testing_backend.rs#L398-L434","documentation":"The testing backend's `deliver_native_drag` requires a simulated native drag to have been started beforehand; it reads drag data from an internal `native_drag` cell. If no drag is in flight the cell is `None` and the backend panics.","triggerScenarios":"Calling `simulate_native_drag_move()` or `simulate_native_drop()` without a prior call that starts a simulated native drag (e.g. `simulate_native_drag_enter`/equivalent start API) on the testing backend.","commonSituations":"Test scripts that skip the drag-start step; reordering refactored test steps so drop/move happens after the drag was already consumed by a previous drop; writing only a 'drop' simulation assuming it stands alone.","solutions":["Start the simulated native drag (drag-enter/press with drag data) before calling move or drop","Ensure each drop has exactly one preceding drag start; a second drop after the drag was consumed also panics","Reset or recreate the test backend/window between drag scenarios"],"exampleFix":"// before\nbackend.simulate_native_drop(&window, pos); // panics: no drag in flight\n// after\nbackend.simulate_native_drag_enter(&window, drag_data);\nbackend.simulate_native_drag_move(&window, pos);\nbackend.simulate_native_drop(&window, pos);","handlingStrategy":"validation","validationCode":"// ensure a drag was started before move/drop in your test harness\nfn ensure_drag_in_flight(backend: &TestingBackend, started: &mut bool) {\n    assert!(*started, \"call drag-enter/start before move or drop\");\n}","typeGuard":null,"tryCatchPattern":"std::panic::catch_unwind(|| backend.simulate_native_drop(&window, pos))\n    .map_err(|_| anyhow!(\"no native drag in flight: start drag first\"))?;","preventionTips":["Always pair each drag move/drop with a preceding drag start","Track drag lifecycle state in your test harness (started/moved/dropped)","Reset the backend between independent drag scenarios"],"tags":["testing","drag-and-drop","panic"],"backgroundTag":"invalid-state-transition","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}