mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-05-04 06:33:50 +00:00
feat(region): add SRgnDestroy
This commit is contained in:
parent
1e1f2f819f
commit
1e86f98691
5 changed files with 55 additions and 2 deletions
|
|
@ -1,7 +1,8 @@
|
|||
#include "Core.hpp"
|
||||
#include "Event.hpp"
|
||||
#include "Transparency.hpp"
|
||||
#include "Region.hpp"
|
||||
#include "String.hpp"
|
||||
#include "Transparency.hpp"
|
||||
|
||||
int32_t STORMAPI StormDestroy() {
|
||||
// Combined list of all destroy calls found in every game (as documentation)
|
||||
|
|
@ -11,7 +12,7 @@ int32_t STORMAPI StormDestroy() {
|
|||
// SGdiDestroy(); // SC 1.17
|
||||
// SVidDestroy(); // SC 1.17
|
||||
// SDrawDestroy(); // SC 1.17
|
||||
// SRgnDestroy(); // WoW 3.3.5 (win), SC 1.17
|
||||
SRgnDestroy(); // WoW 3.3.5 (win), SC 1.17
|
||||
// SMsgDestroy(); // WoW 3.3.5 (win), SC 1.17
|
||||
// SNetDestroy(); // SC 1.17
|
||||
SEvtDestroy(); // WoW 3.3.5 (win)
|
||||
|
|
|
|||
|
|
@ -578,6 +578,10 @@ void STORMAPI SRgnDelete(HSRGN handle) {
|
|||
s_rgntable.Delete(handle);
|
||||
}
|
||||
|
||||
void STORMAPI SRgnDestroy() {
|
||||
s_rgntable.Destroy();
|
||||
}
|
||||
|
||||
void STORMAPI SRgnDuplicate(HSRGN origHandle, HSRGN* handle, uint32_t reserved) {
|
||||
STORM_VALIDATE_BEGIN;
|
||||
STORM_VALIDATE(handle);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ void STORMAPI SRgnCreate(HSRGN* handlePtr, uint32_t reserved = 0);
|
|||
|
||||
void STORMAPI SRgnDelete(HSRGN handle);
|
||||
|
||||
void STORMAPI SRgnDestroy();
|
||||
|
||||
void STORMAPI SRgnDuplicate(HSRGN origHandle, HSRGN* handle, uint32_t reserved = 0);
|
||||
|
||||
void STORMAPI SRgnGetBoundingRectf(HSRGN handle, RECTF* rect);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "test/Test.hpp"
|
||||
#include "EventTest.hpp"
|
||||
#include "storm/Core.hpp"
|
||||
#include "storm/Region.hpp"
|
||||
|
||||
TEST_CASE("StormDestroy", "[core]") {
|
||||
SECTION("always returns 1") {
|
||||
|
|
@ -36,4 +37,19 @@ TEST_CASE("StormDestroy", "[core]") {
|
|||
CHECK(SEvtDispatch(0, 0, 0, nullptr) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("SRgn") {
|
||||
SECTION("destroys region handles") {
|
||||
HSRGN rgn = nullptr;
|
||||
SRgnCreate(&rgn);
|
||||
REQUIRE(rgn != nullptr); // valid handle
|
||||
|
||||
CHECK(StormDestroy() == 1);
|
||||
|
||||
// fails to duplicate because handle is invalid
|
||||
HSRGN newrgn;
|
||||
SRgnDuplicate(rgn, &newrgn);
|
||||
CHECK(newrgn == nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -691,6 +691,36 @@ TEST_CASE("SRgnDelete", "[region]") {
|
|||
}
|
||||
}
|
||||
|
||||
#if !defined(WHOA_TEST_STORMDLL)
|
||||
TEST_CASE("SRgnDestroy", "[event]") {
|
||||
SECTION("destroys all region handles") {
|
||||
HSRGN rgn1 = nullptr, rgn2 = nullptr, rgn3 = nullptr;
|
||||
HSRGN newrgn1, newrgn2, newrgn3, testrgn1, newtestrgn1;
|
||||
|
||||
SRgnCreate(&rgn1);
|
||||
SRgnCreate(&rgn2);
|
||||
SRgnCreate(&rgn3);
|
||||
REQUIRE(rgn1 != nullptr);
|
||||
REQUIRE(rgn2 != nullptr);
|
||||
REQUIRE(rgn3 != nullptr);
|
||||
|
||||
SRgnDuplicate(rgn1, &testrgn1);
|
||||
CHECK(testrgn1 != nullptr);
|
||||
|
||||
SRgnDestroy();
|
||||
|
||||
SRgnDuplicate(rgn1, &newrgn1);
|
||||
SRgnDuplicate(rgn2, &newrgn2);
|
||||
SRgnDuplicate(rgn3, &newrgn3);
|
||||
SRgnDuplicate(testrgn1, &newtestrgn1);
|
||||
CHECK(newrgn1 == nullptr);
|
||||
CHECK(newrgn2 == nullptr);
|
||||
CHECK(newrgn3 == nullptr);
|
||||
CHECK(newtestrgn1 == nullptr);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_CASE("SRgnDuplicate", "[region]") {
|
||||
RgnDataTest region;
|
||||
RECTF baseRect = { -1.0f, 1.0f, 1.0f, 2.0f };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue