Differential D2175 Diff 16524 binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
Show All 33 Lines | |||||
Engine.LoadComponentScript("interfaces/Timer.js"); | Engine.LoadComponentScript("interfaces/Timer.js"); | ||||
Engine.LoadComponentScript("interfaces/Treasure.js"); | Engine.LoadComponentScript("interfaces/Treasure.js"); | ||||
Engine.LoadComponentScript("interfaces/TreasureCollecter.js"); | Engine.LoadComponentScript("interfaces/TreasureCollecter.js"); | ||||
Engine.LoadComponentScript("interfaces/StatisticsTracker.js"); | Engine.LoadComponentScript("interfaces/StatisticsTracker.js"); | ||||
Engine.LoadComponentScript("interfaces/StatusEffectsReceiver.js"); | Engine.LoadComponentScript("interfaces/StatusEffectsReceiver.js"); | ||||
Engine.LoadComponentScript("interfaces/UnitAI.js"); | Engine.LoadComponentScript("interfaces/UnitAI.js"); | ||||
Engine.LoadComponentScript("interfaces/Upgrade.js"); | Engine.LoadComponentScript("interfaces/Upgrade.js"); | ||||
Engine.LoadComponentScript("interfaces/BuildingAI.js"); | Engine.LoadComponentScript("interfaces/BuildingAI.js"); | ||||
Engine.LoadComponentScript("interfaces/BattalionManager.js"); | |||||
Engine.LoadComponentScript("GuiInterface.js"); | Engine.LoadComponentScript("GuiInterface.js"); | ||||
Resources = { | Resources = { | ||||
"GetCodes": () => ["food", "metal", "stone", "wood"], | "GetCodes": () => ["food", "metal", "stone", "wood"], | ||||
"GetNames": () => ({ | "GetNames": () => ({ | ||||
"food": "Food", | "food": "Food", | ||||
"metal": "Metal", | "metal": "Metal", | ||||
"stone": "Stone", | "stone": "Stone", | ||||
▲ Show 20 Lines • Show All 528 Lines • ▼ Show 20 Lines | AddMock(10, IID_Position, { | ||||
} | } | ||||
}); | }); | ||||
AddMock(10, IID_ResourceTrickle, { | AddMock(10, IID_ResourceTrickle, { | ||||
"GetInterval": () => 1250, | "GetInterval": () => 1250, | ||||
"GetRates": () => ({ "food": 2, "wood": 3, "stone": 5, "metal": 9 }) | "GetRates": () => ({ "food": 2, "wood": 3, "stone": 5, "metal": 9 }) | ||||
}); | }); | ||||
AddMock(SYSTEM_ENTITY, IID_BattalionManager, { | |||||
"PartOfBattalion": () => false | |||||
}); | |||||
// Note: property order matters when using TS_ASSERT_UNEVAL_EQUALS, | // Note: property order matters when using TS_ASSERT_UNEVAL_EQUALS, | ||||
// because uneval preserves property order. So make sure this object | // because uneval preserves property order. So make sure this object | ||||
// matches the ordering in GuiInterface. | // matches the ordering in GuiInterface. | ||||
TS_ASSERT_UNEVAL_EQUALS(cmp.GetEntityState(-1, 10), { | TS_ASSERT_UNEVAL_EQUALS(cmp.GetEntityState(-1, 10), { | ||||
"id": 10, | "id": 10, | ||||
"player": INVALID_PLAYER, | "player": INVALID_PLAYER, | ||||
"template": "example", | "template": "example", | ||||
"identity": { | "identity": { | ||||
"rank": "foo", | "rank": "foo", | ||||
"classes": ["class1", "class2"], | "classes": ["class1", "class2"], | ||||
"selectionGroupName": "Selection Group Name", | "selectionGroupName": "Selection Group Name", | ||||
"canDelete": true, | "canDelete": true, | ||||
"hasSomeFormation": false, | "hasSomeFormation": false, | ||||
"formations": [], | "formations": [], | ||||
"controllable": true, | "controllable": true, | ||||
}, | }, | ||||
"position": { "x": 1, "y": 2, "z": 3 }, | "position": { "x": 1, "y": 2, "z": 3 }, | ||||
"hitpoints": 50, | "hitpoints": 50, | ||||
"maxHitpoints": 60, | "maxHitpoints": 60, | ||||
"needsRepair": false, | "needsRepair": false, | ||||
"needsHeal": true, | "needsHeal": true, | ||||
"battalion": false, | |||||
"builder": true, | "builder": true, | ||||
"visibility": "visible", | "visibility": "visible", | ||||
"isBarterMarket": true, | "isBarterMarket": true, | ||||
"resourceTrickle": { | "resourceTrickle": { | ||||
"interval": 1250, | "interval": 1250, | ||||
"rates": { "food": 2, "wood": 3, "stone": 5, "metal": 9 } | "rates": { "food": 2, "wood": 3, "stone": 5, "metal": 9 } | ||||
} | } | ||||
}); | }); |
Wildfire Games · Phabricator