test: add test for default icon resource
This commit is contained in:
@@ -36,15 +36,6 @@ using CStyleString = const char*;
|
|||||||
* And we expose this type as an opaque handle for visiting your created object.
|
* And we expose this type as an opaque handle for visiting your created object.
|
||||||
*/
|
*/
|
||||||
using Token = uint64_t;
|
using Token = uint64_t;
|
||||||
#else // __cplusplus
|
|
||||||
typedef const char *CStyleString;
|
|
||||||
typedef uint64_t Token;
|
|
||||||
#endif // __cplusplus
|
|
||||||
|
|
||||||
|
|
||||||
// Special treat for ICON because it may be defined by Windows header.
|
|
||||||
#ifndef _WINDEF_
|
|
||||||
#ifdef __cplusplus
|
|
||||||
/**
|
/**
|
||||||
* @brief Type representing an icon handle (opaque pointer)
|
* @brief Type representing an icon handle (opaque pointer)
|
||||||
*
|
*
|
||||||
@@ -52,9 +43,10 @@ typedef uint64_t Token;
|
|||||||
*/
|
*/
|
||||||
using HICON = void*;
|
using HICON = void*;
|
||||||
#else // __cplusplus
|
#else // __cplusplus
|
||||||
|
typedef const char *CStyleString;
|
||||||
|
typedef uint64_t Token;
|
||||||
typedef void *HICON;
|
typedef void *HICON;
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -186,6 +186,9 @@ fn test_str_ref_str() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_icon_rc() {
|
fn test_icon_rc() {
|
||||||
|
fn const_tester(icon: Result<IconRc, LoadIconRcError>) {
|
||||||
|
assert!(icon.is_ok())
|
||||||
|
}
|
||||||
fn ok_tester(file: &str, index: u32) {
|
fn ok_tester(file: &str, index: u32) {
|
||||||
let icon = IconRc::new(file, index, IconSizeKind::Small);
|
let icon = IconRc::new(file, index, IconSizeKind::Small);
|
||||||
assert!(icon.is_ok())
|
assert!(icon.is_ok())
|
||||||
@@ -195,6 +198,9 @@ fn test_icon_rc() {
|
|||||||
assert!(icon.is_err())
|
assert!(icon.is_err())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test 2 const value
|
||||||
|
const_tester(IconRc::GENERIC_APPLICATION(IconSizeKind::Small));
|
||||||
|
const_tester(IconRc::GENERIC_APPLICATION(IconSizeKind::Small));
|
||||||
// We pick it from "jpegfile" ProgId
|
// We pick it from "jpegfile" ProgId
|
||||||
ok_tester("imageres.dll", 72);
|
ok_tester("imageres.dll", 72);
|
||||||
ok_tester("notepad.exe", 0);
|
ok_tester("notepad.exe", 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user