diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index d1e46bfe62..651cf84e16 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -187,8 +187,6 @@ jobs: run: cargo clippy -p test_extensions - name: Clippy test_handles run: cargo clippy -p test_handles - - name: Clippy test_helpers - run: cargo clippy -p test_helpers - name: Clippy test_implement run: cargo clippy -p test_implement - name: Clippy test_implement_core diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a078f368e1..6295cd9456 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -213,8 +213,6 @@ jobs: run: cargo test -p test_extensions --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_handles run: cargo test -p test_handles --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Test test_helpers - run: cargo test -p test_helpers --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_implement run: cargo test -p test_implement --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_implement_core @@ -255,10 +253,10 @@ jobs: run: cargo test -p test_reference_float --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_registry run: cargo test -p test_registry --target ${{ matrix.target }} ${{ matrix.etc }} - - name: Clean - run: cargo clean - name: Test test_registry_default run: cargo test -p test_registry_default --target ${{ matrix.target }} ${{ matrix.etc }} + - name: Clean + run: cargo clean - name: Test test_reserved run: cargo test -p test_reserved --target ${{ matrix.target }} ${{ matrix.etc }} - name: Test test_resources diff --git a/crates/libs/helpers/Cargo.toml b/crates/libs/helpers/Cargo.toml index 33173d34fc..dfdd9368c5 100644 --- a/crates/libs/helpers/Cargo.toml +++ b/crates/libs/helpers/Cargo.toml @@ -7,3 +7,4 @@ publish = false [dependencies] regex = "1.7" windows-metadata = { workspace = true } +windows-targets = { workspace = true } diff --git a/crates/libs/helpers/src/lib.rs b/crates/libs/helpers/src/lib.rs index 04e9fd3110..ae69aa2ea9 100644 --- a/crates/libs/helpers/src/lib.rs +++ b/crates/libs/helpers/src/lib.rs @@ -98,3 +98,21 @@ fn find>(path: P, regex: &Regex) -> Vec<(String, String)> { names } + +pub fn set_thread_ui_language() { + // Enables testing without pulling in a dependency on the `windows` crate. + windows_targets::link!("kernel32.dll" "system" fn SetThreadPreferredUILanguages(flags : u32, language : *const u16, _ : *mut u32) -> i32); + pub const MUI_LANGUAGE_NAME: u32 = 8u32; + + let language: Vec<_> = "en-US".encode_utf16().chain(std::iter::once(0)).collect(); + unsafe { + assert_eq!( + 1, + SetThreadPreferredUILanguages( + MUI_LANGUAGE_NAME, + language.as_ptr(), + std::ptr::null_mut() + ) + ); + } +} diff --git a/crates/tests/misc/core/Cargo.toml b/crates/tests/misc/core/Cargo.toml index ca168f7d98..47e98432a7 100644 --- a/crates/tests/misc/core/Cargo.toml +++ b/crates/tests/misc/core/Cargo.toml @@ -25,4 +25,4 @@ workspace = true workspace = true [dev-dependencies] -helpers = { package = "test_helpers", path = "../helpers" } +helpers = { workspace = true } diff --git a/crates/tests/misc/enums/Cargo.toml b/crates/tests/misc/enums/Cargo.toml index fef13627ef..73428dc513 100644 --- a/crates/tests/misc/enums/Cargo.toml +++ b/crates/tests/misc/enums/Cargo.toml @@ -22,4 +22,4 @@ features = [ ] [dev-dependencies] -helpers = { package = "test_helpers", path = "../helpers" } +helpers = { workspace = true } diff --git a/crates/tests/misc/error/Cargo.toml b/crates/tests/misc/error/Cargo.toml index 87a5fb2ad2..6279f20cd1 100644 --- a/crates/tests/misc/error/Cargo.toml +++ b/crates/tests/misc/error/Cargo.toml @@ -17,4 +17,4 @@ features = [ ] [dev-dependencies] -helpers = { package = "test_helpers", path = "../helpers" } +helpers = { workspace = true } diff --git a/crates/tests/misc/helpers/Cargo.toml b/crates/tests/misc/helpers/Cargo.toml deleted file mode 100644 index 80a20e9be6..0000000000 --- a/crates/tests/misc/helpers/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "test_helpers" -version = "0.0.0" -edition = "2021" -publish = false - -[lib] -doc = false -doctest = false - -[dependencies.windows-targets] -workspace = true diff --git a/crates/tests/misc/helpers/src/lib.rs b/crates/tests/misc/helpers/src/lib.rs deleted file mode 100644 index 1755e3cdd7..0000000000 --- a/crates/tests/misc/helpers/src/lib.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Enables testing without pulling in a dependency on the `windows` crate. -windows_targets::link!("kernel32.dll" "system" fn SetThreadPreferredUILanguages(flags : u32, language : *const u16, _ : *mut u32) -> i32); -pub const MUI_LANGUAGE_NAME: u32 = 8u32; - -pub fn set_thread_ui_language() { - let language: Vec<_> = "en-US".encode_utf16().chain(std::iter::once(0)).collect(); - unsafe { - assert_eq!( - 1, - SetThreadPreferredUILanguages( - MUI_LANGUAGE_NAME, - language.as_ptr(), - std::ptr::null_mut() - ) - ); - } -} diff --git a/crates/tests/misc/result/Cargo.toml b/crates/tests/misc/result/Cargo.toml index 93e80b6e10..5e4ebb00e6 100644 --- a/crates/tests/misc/result/Cargo.toml +++ b/crates/tests/misc/result/Cargo.toml @@ -15,7 +15,7 @@ workspace = true workspace = true [dependencies] -helpers = { package = "test_helpers", path = "../helpers" } +helpers = { workspace = true } static_assertions = "1.0" [lints.rust] diff --git a/crates/tests/misc/strings/Cargo.toml b/crates/tests/misc/strings/Cargo.toml index 1b0b3834e5..1dc08c1425 100644 --- a/crates/tests/misc/strings/Cargo.toml +++ b/crates/tests/misc/strings/Cargo.toml @@ -22,4 +22,4 @@ features = [ ] [dev-dependencies] -helpers = { package = "test_helpers", path = "../helpers" } +helpers = { workspace = true } diff --git a/crates/tests/misc/win32/Cargo.toml b/crates/tests/misc/win32/Cargo.toml index 306e809798..f9c98e4077 100644 --- a/crates/tests/misc/win32/Cargo.toml +++ b/crates/tests/misc/win32/Cargo.toml @@ -35,4 +35,4 @@ features = [ ] [dev-dependencies] -helpers = { package = "test_helpers", path = "../helpers" } +helpers = { workspace = true } diff --git a/crates/tests/misc/collections/Cargo.toml b/crates/tests/winrt/collections/Cargo.toml similarity index 100% rename from crates/tests/misc/collections/Cargo.toml rename to crates/tests/winrt/collections/Cargo.toml diff --git a/crates/tests/misc/collections/src/lib.rs b/crates/tests/winrt/collections/src/lib.rs similarity index 100% rename from crates/tests/misc/collections/src/lib.rs rename to crates/tests/winrt/collections/src/lib.rs diff --git a/crates/tests/misc/collections/tests/stock_iterable.rs b/crates/tests/winrt/collections/tests/stock_iterable.rs similarity index 100% rename from crates/tests/misc/collections/tests/stock_iterable.rs rename to crates/tests/winrt/collections/tests/stock_iterable.rs diff --git a/crates/tests/misc/collections/tests/stock_map_view.rs b/crates/tests/winrt/collections/tests/stock_map_view.rs similarity index 100% rename from crates/tests/misc/collections/tests/stock_map_view.rs rename to crates/tests/winrt/collections/tests/stock_map_view.rs diff --git a/crates/tests/misc/collections/tests/stock_vector_view.rs b/crates/tests/winrt/collections/tests/stock_vector_view.rs similarity index 100% rename from crates/tests/misc/collections/tests/stock_vector_view.rs rename to crates/tests/winrt/collections/tests/stock_vector_view.rs diff --git a/crates/tests/misc/collections/tests/string_map.rs b/crates/tests/winrt/collections/tests/string_map.rs similarity index 100% rename from crates/tests/misc/collections/tests/string_map.rs rename to crates/tests/winrt/collections/tests/string_map.rs diff --git a/crates/tests/misc/event/Cargo.toml b/crates/tests/winrt/event/Cargo.toml similarity index 100% rename from crates/tests/misc/event/Cargo.toml rename to crates/tests/winrt/event/Cargo.toml diff --git a/crates/tests/misc/event/src/lib.rs b/crates/tests/winrt/event/src/lib.rs similarity index 100% rename from crates/tests/misc/event/src/lib.rs rename to crates/tests/winrt/event/src/lib.rs diff --git a/crates/tests/misc/event/tests/tests.rs b/crates/tests/winrt/event/tests/tests.rs similarity index 100% rename from crates/tests/misc/event/tests/tests.rs rename to crates/tests/winrt/event/tests/tests.rs diff --git a/crates/tests/misc/noexcept/Cargo.toml b/crates/tests/winrt/noexcept/Cargo.toml similarity index 100% rename from crates/tests/misc/noexcept/Cargo.toml rename to crates/tests/winrt/noexcept/Cargo.toml diff --git a/crates/tests/misc/noexcept/build.rs b/crates/tests/winrt/noexcept/build.rs similarity index 100% rename from crates/tests/misc/noexcept/build.rs rename to crates/tests/winrt/noexcept/build.rs diff --git a/crates/tests/misc/noexcept/src/bindings.rs b/crates/tests/winrt/noexcept/src/bindings.rs similarity index 100% rename from crates/tests/misc/noexcept/src/bindings.rs rename to crates/tests/winrt/noexcept/src/bindings.rs diff --git a/crates/tests/misc/noexcept/src/interop.cpp b/crates/tests/winrt/noexcept/src/interop.cpp similarity index 100% rename from crates/tests/misc/noexcept/src/interop.cpp rename to crates/tests/winrt/noexcept/src/interop.cpp diff --git a/crates/tests/misc/noexcept/src/lib.rs b/crates/tests/winrt/noexcept/src/lib.rs similarity index 100% rename from crates/tests/misc/noexcept/src/lib.rs rename to crates/tests/winrt/noexcept/src/lib.rs diff --git a/crates/tests/misc/noexcept/src/test.idl b/crates/tests/winrt/noexcept/src/test.idl similarity index 100% rename from crates/tests/misc/noexcept/src/test.idl rename to crates/tests/winrt/noexcept/src/test.idl diff --git a/crates/tests/misc/noexcept/tests/test.rs b/crates/tests/winrt/noexcept/tests/test.rs similarity index 100% rename from crates/tests/misc/noexcept/tests/test.rs rename to crates/tests/winrt/noexcept/tests/test.rs diff --git a/crates/tests/misc/winrt_old/Cargo.toml b/crates/tests/winrt/old/Cargo.toml similarity index 90% rename from crates/tests/misc/winrt_old/Cargo.toml rename to crates/tests/winrt/old/Cargo.toml index a2064a3218..68955e26a6 100644 --- a/crates/tests/misc/winrt_old/Cargo.toml +++ b/crates/tests/winrt/old/Cargo.toml @@ -29,4 +29,4 @@ features = [ ] [dev-dependencies] -helpers = { package = "test_helpers", path = "../helpers" } +helpers = { workspace = true } diff --git a/crates/tests/misc/winrt_old/src/lib.rs b/crates/tests/winrt/old/src/lib.rs similarity index 100% rename from crates/tests/misc/winrt_old/src/lib.rs rename to crates/tests/winrt/old/src/lib.rs diff --git a/crates/tests/misc/winrt_old/tests/async.rs b/crates/tests/winrt/old/tests/async.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/async.rs rename to crates/tests/winrt/old/tests/async.rs diff --git a/crates/tests/misc/winrt_old/tests/cast.rs b/crates/tests/winrt/old/tests/cast.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/cast.rs rename to crates/tests/winrt/old/tests/cast.rs diff --git a/crates/tests/misc/winrt_old/tests/collections.rs b/crates/tests/winrt/old/tests/collections.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/collections.rs rename to crates/tests/winrt/old/tests/collections.rs diff --git a/crates/tests/misc/winrt_old/tests/collisions.rs b/crates/tests/winrt/old/tests/collisions.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/collisions.rs rename to crates/tests/winrt/old/tests/collisions.rs diff --git a/crates/tests/misc/winrt_old/tests/composition.rs b/crates/tests/winrt/old/tests/composition.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/composition.rs rename to crates/tests/winrt/old/tests/composition.rs diff --git a/crates/tests/misc/winrt_old/tests/delegates.rs b/crates/tests/winrt/old/tests/delegates.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/delegates.rs rename to crates/tests/winrt/old/tests/delegates.rs diff --git a/crates/tests/misc/winrt_old/tests/enum.rs b/crates/tests/winrt/old/tests/enum.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/enum.rs rename to crates/tests/winrt/old/tests/enum.rs diff --git a/crates/tests/misc/winrt_old/tests/error.rs b/crates/tests/winrt/old/tests/error.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/error.rs rename to crates/tests/winrt/old/tests/error.rs diff --git a/crates/tests/misc/winrt_old/tests/generic_guids.rs b/crates/tests/winrt/old/tests/generic_guids.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/generic_guids.rs rename to crates/tests/winrt/old/tests/generic_guids.rs diff --git a/crates/tests/misc/winrt_old/tests/guid.rs b/crates/tests/winrt/old/tests/guid.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/guid.rs rename to crates/tests/winrt/old/tests/guid.rs diff --git a/crates/tests/misc/winrt_old/tests/interface.rs b/crates/tests/winrt/old/tests/interface.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/interface.rs rename to crates/tests/winrt/old/tests/interface.rs diff --git a/crates/tests/misc/winrt_old/tests/namespace.rs b/crates/tests/winrt/old/tests/namespace.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/namespace.rs rename to crates/tests/winrt/old/tests/namespace.rs diff --git a/crates/tests/misc/winrt_old/tests/numerics.rs b/crates/tests/winrt/old/tests/numerics.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/numerics.rs rename to crates/tests/winrt/old/tests/numerics.rs diff --git a/crates/tests/misc/winrt_old/tests/object.rs b/crates/tests/winrt/old/tests/object.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/object.rs rename to crates/tests/winrt/old/tests/object.rs diff --git a/crates/tests/misc/winrt_old/tests/send_sync.rs b/crates/tests/winrt/old/tests/send_sync.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/send_sync.rs rename to crates/tests/winrt/old/tests/send_sync.rs diff --git a/crates/tests/misc/winrt_old/tests/static_class.rs b/crates/tests/winrt/old/tests/static_class.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/static_class.rs rename to crates/tests/winrt/old/tests/static_class.rs diff --git a/crates/tests/misc/winrt_old/tests/uri.rs b/crates/tests/winrt/old/tests/uri.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/uri.rs rename to crates/tests/winrt/old/tests/uri.rs diff --git a/crates/tests/misc/winrt_old/tests/xml.rs b/crates/tests/winrt/old/tests/xml.rs similarity index 100% rename from crates/tests/misc/winrt_old/tests/xml.rs rename to crates/tests/winrt/old/tests/xml.rs