Make networking module be unfeature flagged, added more tests
This commit is contained in:
parent
ba893c3400
commit
46b313b585
|
@ -141,7 +141,7 @@ impl Image {
|
||||||
let file_path = NSString::new(path);
|
let file_path = NSString::new(path);
|
||||||
|
|
||||||
Image(unsafe {
|
Image(unsafe {
|
||||||
let alloc: id = msg_send![class!(NSImage), alloc];
|
let alloc: id = msg_send![Self::class(), alloc];
|
||||||
ShareId::from_ptr(msg_send![alloc, initWithContentsOfFile: file_path])
|
ShareId::from_ptr(msg_send![alloc, initWithContentsOfFile: file_path])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ impl Image {
|
||||||
Image(unsafe {
|
Image(unsafe {
|
||||||
ShareId::from_ptr({
|
ShareId::from_ptr({
|
||||||
let icon = icon.to_id();
|
let icon = icon.to_id();
|
||||||
msg_send![class!(NSImage), imageNamed: icon]
|
msg_send![Self::class(), imageNamed: icon]
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -188,13 +188,13 @@ impl Image {
|
||||||
true => {
|
true => {
|
||||||
let icon = NSString::new(icon.to_sfsymbol_str());
|
let icon = NSString::new(icon.to_sfsymbol_str());
|
||||||
let desc = NSString::new(accessibility_description);
|
let desc = NSString::new(accessibility_description);
|
||||||
msg_send![class!(NSImage), imageWithSystemSymbolName:&*icon
|
msg_send![Self::class(), imageWithSystemSymbolName:&*icon
|
||||||
accessibilityDescription:&*desc]
|
accessibilityDescription:&*desc]
|
||||||
},
|
},
|
||||||
|
|
||||||
false => {
|
false => {
|
||||||
let icon = icon.to_id();
|
let icon = icon.to_id();
|
||||||
msg_send![class!(NSImage), imageNamed: icon]
|
msg_send![Self::class(), imageNamed: icon]
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -222,7 +222,7 @@ impl Image {
|
||||||
true => {
|
true => {
|
||||||
let icon = NSString::new(symbol.to_str());
|
let icon = NSString::new(symbol.to_str());
|
||||||
let desc = NSString::new(accessibility_description);
|
let desc = NSString::new(accessibility_description);
|
||||||
msg_send![class!(NSImage), imageWithSystemSymbolName:&*icon
|
msg_send![Self::class(), imageWithSystemSymbolName:&*icon
|
||||||
accessibilityDescription:&*desc]
|
accessibilityDescription:&*desc]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ impl Image {
|
||||||
let block = block.copy();
|
let block = block.copy();
|
||||||
|
|
||||||
Image(unsafe {
|
Image(unsafe {
|
||||||
let img: id = msg_send![class!(NSImage), imageWithSize:target_frame.size
|
let img: id = msg_send![Self::class(), imageWithSize:target_frame.size
|
||||||
flipped:YES
|
flipped:YES
|
||||||
drawingHandler:block
|
drawingHandler:block
|
||||||
];
|
];
|
||||||
|
@ -285,3 +285,14 @@ impl Image {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_image_from_bytes() {
|
||||||
|
let image_bytes = include_bytes!("../../test-data/favicon.ico");
|
||||||
|
let image = Image::with_data(image_bytes);
|
||||||
|
}
|
||||||
|
#[test]
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
fn test_image_from_file() {
|
||||||
|
let image = Image::with_contents_of_file("./test-data/favicon.ico");
|
||||||
|
}
|
||||||
|
|
|
@ -148,10 +148,10 @@ pub mod keys;
|
||||||
|
|
||||||
pub mod layer;
|
pub mod layer;
|
||||||
pub mod layout;
|
pub mod layout;
|
||||||
|
pub mod networking;
|
||||||
|
|
||||||
#[cfg(feature = "appkit")]
|
#[cfg(feature = "appkit")]
|
||||||
pub mod listview;
|
pub mod listview;
|
||||||
pub mod networking;
|
|
||||||
pub mod notification_center;
|
pub mod notification_center;
|
||||||
pub(crate) mod objc_access;
|
pub(crate) mod objc_access;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue