Differential D2376 Diff 14941 ps/trunk/binaries/data/mods/public/simulation/components/tests/test_GarrisonHolder.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/simulation/components/tests/test_GarrisonHolder.js
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | else if (i == 34) | ||||
AddMock(i, IID_Ownership, { | AddMock(i, IID_Ownership, { | ||||
"GetOwner": () => enemyPlayer | "GetOwner": () => enemyPlayer | ||||
}); | }); | ||||
else | else | ||||
AddMock(i, IID_Ownership, { | AddMock(i, IID_Ownership, { | ||||
"GetOwner": () => friendlyPlayer | "GetOwner": () => friendlyPlayer | ||||
}); | }); | ||||
AddMock(i, IID_Garrisonable, {}); | AddMock(i, IID_Garrisonable, { | ||||
"Garrison": entity => true, | |||||
"UnGarrison": () => {} | |||||
}); | |||||
AddMock(i, IID_Position, { | AddMock(i, IID_Position, { | ||||
"GetHeightOffset": () => 0, | "GetHeightOffset": () => 0, | ||||
"GetPosition": () => new Vector3D(4, 3, 25), | "GetPosition": () => new Vector3D(4, 3, 25), | ||||
"GetRotation": () => new Vector3D(4, 0, 6), | "GetRotation": () => new Vector3D(4, 0, 6), | ||||
"JumpTo": (posX, posZ) => {}, | "JumpTo": (posX, posZ) => {}, | ||||
"MoveOutOfWorld": () => {}, | "MoveOutOfWorld": () => {}, | ||||
"SetHeightOffset": height => {} | "SetHeightOffset": height => {} | ||||
▲ Show 20 Lines • Show All 127 Lines • ▼ Show 20 Lines | AddMock(siegeEngineId, IID_Position, { | ||||
"JumpTo": (posX, posZ) => {}, | "JumpTo": (posX, posZ) => {}, | ||||
"MoveOutOfWorld": () => {}, | "MoveOutOfWorld": () => {}, | ||||
"SetHeightOffset": height => {} | "SetHeightOffset": height => {} | ||||
}); | }); | ||||
let currentSiegePlayer = player; | let currentSiegePlayer = player; | ||||
AddMock(siegeEngineId, IID_Ownership, { | AddMock(siegeEngineId, IID_Ownership, { | ||||
"GetOwner": () => currentSiegePlayer | "GetOwner": () => currentSiegePlayer | ||||
}); | }); | ||||
AddMock(siegeEngineId, IID_Garrisonable, {}); | AddMock(siegeEngineId, IID_Garrisonable, { | ||||
"Garrison": entity => true, | |||||
"UnGarrison": () => {} | |||||
}); | |||||
let cavalryId = 46; | let cavalryId = 46; | ||||
AddMock(cavalryId, IID_Identity, { | AddMock(cavalryId, IID_Identity, { | ||||
"GetClassesList": () => ["Infantry", "Ranged"] | "GetClassesList": () => ["Infantry", "Ranged"] | ||||
}); | }); | ||||
AddMock(cavalryId, IID_Position, { | AddMock(cavalryId, IID_Position, { | ||||
"GetHeightOffset": () => 0, | "GetHeightOffset": () => 0, | ||||
"GetPosition": () => new Vector3D(4, 3, 25), | "GetPosition": () => new Vector3D(4, 3, 25), | ||||
"GetRotation": () => new Vector3D(4, 0, 6), | "GetRotation": () => new Vector3D(4, 0, 6), | ||||
"JumpTo": (posX, posZ) => {}, | "JumpTo": (posX, posZ) => {}, | ||||
"MoveOutOfWorld": () => {}, | "MoveOutOfWorld": () => {}, | ||||
"SetHeightOffset": height => {} | "SetHeightOffset": height => {} | ||||
}); | }); | ||||
let currentCavalryPlayer = player; | let currentCavalryPlayer = player; | ||||
AddMock(cavalryId, IID_Ownership, { | AddMock(cavalryId, IID_Ownership, { | ||||
"GetOwner": () => currentCavalryPlayer | "GetOwner": () => currentCavalryPlayer | ||||
}); | }); | ||||
AddMock(cavalryId, IID_Garrisonable, {}); | AddMock(cavalryId, IID_Garrisonable, { | ||||
"Garrison": entity => true, | |||||
"UnGarrison": () => {} | |||||
}); | |||||
TS_ASSERT(cmpGarrisonHolder.Garrison(siegeEngineId)); | TS_ASSERT(cmpGarrisonHolder.Garrison(siegeEngineId)); | ||||
TS_ASSERT_EQUALS(cmpGarrisonHolder.GetGarrisonedEntitiesCount(), 1); | TS_ASSERT_EQUALS(cmpGarrisonHolder.GetGarrisonedEntitiesCount(), 1); | ||||
cmpGarrisonHolder.OnGlobalEntityRenamed({ | cmpGarrisonHolder.OnGlobalEntityRenamed({ | ||||
"entity": siegeEngineId, | "entity": siegeEngineId, | ||||
"newentity": cavalryId | "newentity": cavalryId | ||||
}); | }); | ||||
TS_ASSERT_EQUALS(cmpGarrisonHolder.GetGarrisonedEntitiesCount(), 1); | TS_ASSERT_EQUALS(cmpGarrisonHolder.GetGarrisonedEntitiesCount(), 1); | ||||
Show All 33 Lines |
Wildfire Games · Phabricator