aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/tests/close_open_container.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-12-22 21:43:54 -1400
committermat <git@matdoes.dev>2025-12-22 21:43:54 -1400
commit82e3d46ca319badcbc584cf902aeebcbd30948b9 (patch)
tree4afb8c6135caacbdf9f1f04d451cb2bae1c488b6 /azalea-client/tests/close_open_container.rs
parent0429a81d706da7c45600d357f9f9a14cef6113b4 (diff)
downloadazalea-drasl-82e3d46ca319badcbc584cf902aeebcbd30948b9.tar.xz
run azalea-client integration tests as one binary
per https://corrode.dev/blog/tips-for-faster-rust-compile-times/\#combine-all-integration-tests-into-a-single-binary <3
Diffstat (limited to 'azalea-client/tests/close_open_container.rs')
-rw-r--r--azalea-client/tests/close_open_container.rs67
1 files changed, 0 insertions, 67 deletions
diff --git a/azalea-client/tests/close_open_container.rs b/azalea-client/tests/close_open_container.rs
deleted file mode 100644
index 32a9874d..00000000
--- a/azalea-client/tests/close_open_container.rs
+++ /dev/null
@@ -1,67 +0,0 @@
-use azalea_chat::FormattedText;
-use azalea_client::test_utils::prelude::*;
-use azalea_core::position::ChunkPos;
-use azalea_entity::inventory::Inventory;
-use azalea_protocol::packets::{
- ConnectionProtocol,
- game::{ClientboundContainerClose, ClientboundOpenScreen, ClientboundSetChunkCacheCenter},
-};
-use azalea_registry::builtin::MenuKind;
-
-#[test]
-fn test_close_open_container() {
- init_tracing();
-
- let mut simulation = Simulation::new(ConnectionProtocol::Game);
-
- simulation.receive_packet(default_login_packet());
- simulation.tick();
- // receive a chunk so the player is "loaded" now
- simulation.receive_packet(ClientboundSetChunkCacheCenter { x: 1, z: 23 });
- simulation.receive_packet(make_basic_empty_chunk(
- ChunkPos::new(1, 23),
- (384 + 64) / 16,
- ));
- simulation.tick();
-
- // ensure no container is open
- simulation.with_component(|inventory: &Inventory| {
- assert!(inventory.container_menu.is_none());
- assert_eq!(inventory.id, 0);
- });
-
- // open a container
- simulation.receive_packet(ClientboundOpenScreen {
- container_id: 1,
- menu_type: MenuKind::Generic9x3,
- title: FormattedText::default(),
- });
- simulation.tick();
-
- simulation.with_component(|inventory: &Inventory| {
- assert!(inventory.container_menu.is_some());
- assert_eq!(inventory.id, 1);
- });
-
- // close and open
- simulation.receive_packet(ClientboundContainerClose { container_id: 1 });
- simulation.receive_packet(ClientboundOpenScreen {
- container_id: 2,
- menu_type: MenuKind::Generic9x3,
- title: FormattedText::default(),
- });
- simulation.tick();
- simulation.with_component(|inventory: &Inventory| {
- // ensure that the new container was opened
- assert!(inventory.container_menu.is_some());
- assert_eq!(inventory.id, 2);
- });
-
- // close with the wrong container id should still close
- simulation.receive_packet(ClientboundContainerClose { container_id: 123 });
- simulation.tick();
- simulation.with_component(|inventory: &Inventory| {
- assert!(inventory.container_menu.is_none());
- assert_eq!(inventory.id, 0);
- });
-}