use crate::platform::macos_objc2::MacOSObjc2Platform;
use crate::platform::Platform;
#[test]
fn release_diagnostics_parity() {
let backend = MacOSObjc2Platform::new();
backend.init();
assert_eq!(backend.backend_name(), "macos-objc2-preview");
}
#[test]
fn docs_changelog_migration_notes() {
let backend = MacOSObjc2Platform::new();
assert_eq!(backend.backend_name(), "macos-objc2-preview");
}
#[test]
fn dependency_policy_cocoa_fallback() {
let backend = MacOSObjc2Platform::new();
assert_eq!(backend.backend_name(), "macos-objc2-preview");
}
#[test]
fn warning_clean_publish_path() {
let backend = MacOSObjc2Platform::new();
backend.init();
assert_eq!(backend.backend_name(), "macos-objc2-preview");
}
#[test]
fn objc2_reports_no_native_controls() {
let backend = MacOSObjc2Platform::new();
backend.init();
let window = backend.create_window("w", 0, 0, 200, 120);
assert!(window > 0, "the window is the one thing this host does create");
assert_eq!(backend.create_button(window, "btn", 10, 10, 80, 24), 0);
assert_eq!(backend.create_checkbox(window, "chk", 10, 10, 80, 24), 0);
assert_eq!(backend.create_line_edit(window, "edit", 10, 10, 80, 24), 0);
assert_eq!(backend.create_label(window, "lbl", 10, 10, 80, 24), 0);
assert_eq!(backend.create_slider(window, 10, 10, 80, 24), 0);
assert_eq!(backend.create_progress_bar(window, 10, 10, 80, 24), 0);
assert_eq!(backend.create_menu_bar(window, 0, 0, 200, 24), 0);
assert_eq!(backend.create_status_bar(window, "Ready", 0, 96, 200, 24), 0);
}
#[test]
fn objc2_owns_no_control_state() {
let backend = MacOSObjc2Platform::new();
backend.init();
let window = backend.create_window("w", 0, 0, 200, 120);
assert_eq!(backend.widget_value(window), None, "no numeric value to report");
assert_eq!(backend.is_widget_checked(window), None, "nothing here is checkable");
assert_eq!(backend.get_widget_text(window), "", "no control text to read back");
}
#[test]
fn objc2_window_lifecycle_parity() {
let backend = MacOSObjc2Platform::new();
backend.init();
let window = backend.create_window("TestWindow", 100, 200, 640, 480);
assert!(window > 0, "Window should be created");
assert!(!backend.is_widget_visible(window), "the host holds no control visibility");
assert!(backend.destroy_widget(window), "an existing window must be destroyable");
assert!(!backend.destroy_widget(window), "a destroyed window must not report existence twice");
}
#[test]
fn objc2_clipboard_roundtrip() {
let backend = MacOSObjc2Platform::new();
backend.init();
assert!(backend.set_clipboard_text("clip"), "Should set clipboard text");
assert_eq!(backend.get_clipboard_text(), "clip", "Clipboard text should match");
}
#[test]
fn objc2_runloop_integration_and_quit() {
let backend = MacOSObjc2Platform::new();
backend.init();
std::thread::scope(|scope| {
scope.spawn(|| {
backend.run();
});
std::thread::sleep(std::time::Duration::from_millis(50));
backend.quit();
});
assert!(
!backend.runtime.running.load(std::sync::atomic::Ordering::SeqCst),
"Backend should not be running after quit"
);
}