Differential D144 Diff 1268 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 First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | |||||
AddMock(100, IID_StatisticsTracker, { | AddMock(100, IID_StatisticsTracker, { | ||||
GetBasicStatistics: function() { | GetBasicStatistics: function() { | ||||
return { | return { | ||||
"resourcesGathered": { | "resourcesGathered": { | ||||
"food": 100, | "food": 100, | ||||
"wood": 0, | "wood": 0, | ||||
"metal": 0, | "metal": 0, | ||||
"stone": 0, | "stone": 0, | ||||
"vegetarianFood": 0, | "vegetarianFood": 0, | ||||
bb: ? | |||||
}, | }, | ||||
"percentMapExplored": 10 | "percentMapExplored": 10 | ||||
}; | }; | ||||
}, | }, | ||||
GetStatistics: function() { | GetSequences: function() { | ||||
return { | return { | ||||
"unitsTrained": 10, | "unitsTrained": [0, 10], | ||||
"unitsLost": 9, | "unitsLost": [0, 42], | ||||
"buildingsConstructed": 5, | "buildingsConstructed": [1, 3], | ||||
"buildingsCaptured": 7, | "buildingsCaptured": [3, 7], | ||||
"buildingsLost": 4, | "buildingsLost": [3, 10], | ||||
"civCentresBuilt": 1, | "civCentresBuilt": [4, 10], | ||||
Not Done Inline Actionsvalues changed a bit but ok bb: values changed a bit but ok | |||||
"resourcesGathered": { | "resourcesGathered": { | ||||
"food": 100, | "food": [5, 100], | ||||
"wood": 0, | "wood": [0, 0], | ||||
"metal": 0, | "metal": [0, 0], | ||||
"stone": 0, | "stone": [0, 0], | ||||
"vegetarianFood": 0, | "vegetarianFood": [0, 0], | ||||
Done Inline ActionsTrailling comma, IIRC it was decided that the trailling comma's in the guiInterface shouldn't be removed, so they should be there in the tests too. bb: Trailling comma, IIRC it was decided that the trailling comma's in the guiInterface shouldn't… | |||||
}, | }, | ||||
"treasuresCollected": 0, | "treasuresCollected": [1, 20], | ||||
"lootCollected": 0, | "lootCollected": [0, 2], | ||||
"percentMapExplored": 10, | "percentMapExplored": [0, 10], | ||||
"teamPercentMapExplored": 10, | "teamPercentMapExplored": [0, 10], | ||||
"percentMapControlled": 10, | "percentMapControlled": [0, 10], | ||||
"teamPercentMapControlled": 10, | "teamPercentMapControlled": [0, 10], | ||||
"peakPercentOfMapControlled": 10, | "peakPercentOfMapControlled": [0, 10], | ||||
"teamPeakPercentOfMapControlled": 10 | "teamPeakPercentOfMapControlled": [0, 10] | ||||
Done Inline Actions.... Like a missing trailling comma here bb: .... Like a missing trailling comma here | |||||
}; | }; | ||||
}, | }, | ||||
IncreaseTrainedUnitsCounter: function() { return 1; }, | IncreaseTrainedUnitsCounter: function() { return 1; }, | ||||
IncreaseConstructedBuildingsCounter: function() { return 1; }, | IncreaseConstructedBuildingsCounter: function() { return 1; }, | ||||
IncreaseBuiltCivCentresCounter: function() { return 1; }, | IncreaseBuiltCivCentresCounter: function() { return 1; }, | ||||
}); | }); | ||||
AddMock(101, IID_Player, { | AddMock(101, IID_Player, { | ||||
▲ Show 20 Lines • Show All 47 Lines • ▼ Show 20 Lines | return { | ||||
"wood": 0, | "wood": 0, | ||||
"metal": 0, | "metal": 0, | ||||
"stone": 0, | "stone": 0, | ||||
"vegetarianFood": 0, | "vegetarianFood": 0, | ||||
}, | }, | ||||
"percentMapExplored": 10 | "percentMapExplored": 10 | ||||
}; | }; | ||||
}, | }, | ||||
GetStatistics: function() { | GetSequences: function() { | ||||
return { | return { | ||||
"unitsTrained": 10, | "unitsTrained": [0, 10], | ||||
"unitsLost": 9, | "unitsLost": [0, 9], | ||||
"buildingsConstructed": 5, | "buildingsConstructed": [0, 5], | ||||
"buildingsCaptured": 7, | "buildingsCaptured": [0, 7], | ||||
"buildingsLost": 4, | "buildingsLost": [0, 4], | ||||
"civCentresBuilt": 1, | "civCentresBuilt": [0, 1], | ||||
"resourcesGathered": { | "resourcesGathered": { | ||||
"food": 100, | "food": [0, 100], | ||||
"wood": 0, | "wood": [0, 0], | ||||
"metal": 0, | "metal": [0, 0], | ||||
"stone": 0, | "stone": [0, 0], | ||||
"vegetarianFood": 0, | "vegetarianFood": [0, 0], | ||||
}, | }, | ||||
"treasuresCollected": 0, | "treasuresCollected": [0, 0], | ||||
"lootCollected": 0, | "lootCollected": [0, 0], | ||||
"percentMapExplored": 10, | "percentMapExplored": [0, 10], | ||||
"teamPercentMapExplored": 10, | "teamPercentMapExplored": [0, 10], | ||||
"percentMapControlled": 10, | "percentMapControlled": [0, 10], | ||||
"teamPercentMapControlled": 10, | "teamPercentMapControlled": [0, 10], | ||||
"peakPercentOfMapControlled": 10, | "peakPercentOfMapControlled": [0, 10], | ||||
"teamPeakPercentOfMapControlled": 10 | "teamPeakPercentOfMapControlled": [0, 10] | ||||
Done Inline ActionsAnd here and more down bb: And here and more down | |||||
}; | }; | ||||
}, | }, | ||||
IncreaseTrainedUnitsCounter: function() { return 1; }, | IncreaseTrainedUnitsCounter: function() { return 1; }, | ||||
IncreaseConstructedBuildingsCounter: function() { return 1; }, | IncreaseConstructedBuildingsCounter: function() { return 1; }, | ||||
IncreaseBuiltCivCentresCounter: function() { return 1; }, | IncreaseBuiltCivCentresCounter: function() { return 1; }, | ||||
}); | }); | ||||
// Note: property order matters when using TS_ASSERT_UNEVAL_EQUALS, | // Note: property order matters when using TS_ASSERT_UNEVAL_EQUALS, | ||||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | "aiInfluenceGroups": { | ||||
"metal": "sparse", | "metal": "sparse", | ||||
"stone": "sparse", | "stone": "sparse", | ||||
"wood": "abundant", | "wood": "abundant", | ||||
} | } | ||||
}, | }, | ||||
}); | }); | ||||
TS_ASSERT_UNEVAL_EQUALS(cmp.GetExtendedSimulationState(), { | TS_ASSERT_UNEVAL_EQUALS(cmp.GetExtendedSimulationState(), { | ||||
players: [ | "players": [ | ||||
{ | { | ||||
name: "Player 1", | "name": "Player 1", | ||||
civ: "gaia", | "civ": "gaia", | ||||
color: { r:1, g:1, b:1, a:1 }, | "color": { "r":1, "g":1, "b":1, "a":1 }, | ||||
controlsAll: false, | "controlsAll": false, | ||||
popCount: 10, | "popCount": 10, | ||||
popLimit: 20, | "popLimit": 20, | ||||
popMax: 200, | "popMax": 200, | ||||
panelEntities: [], | "panelEntities": [], | ||||
resourceCounts: { food: 100 }, | "resourceCounts": { "food": 100 }, | ||||
trainingBlocked: false, | "trainingBlocked": false, | ||||
state: "active", | "state": "active", | ||||
team: -1, | "team": -1, | ||||
teamsLocked: false, | "teamsLocked": false, | ||||
cheatsEnabled: false, | "cheatsEnabled": false, | ||||
disabledTemplates: {}, | "disabledTemplates": {}, | ||||
disabledTechnologies: {}, | "disabledTechnologies": {}, | ||||
hasSharedDropsites: false, | "hasSharedDropsites": false, | ||||
hasSharedLos: false, | "hasSharedLos": false, | ||||
spyCostMultiplier: 1, | "spyCostMultiplier": 1, | ||||
phase: "village", | "phase": "village", | ||||
isAlly: [false, false], | "isAlly": [false, false], | ||||
isMutualAlly: [false, false], | "isMutualAlly": [false, false], | ||||
isNeutral: [false, false], | "isNeutral": [false, false], | ||||
isEnemy: [true, true], | "isEnemy": [true, true], | ||||
entityLimits: {"Foo": 10}, | "entityLimits": {"Foo": 10}, | ||||
entityCounts: {"Foo": 5}, | "entityCounts": {"Foo": 5}, | ||||
entityLimitChangers: {"Foo": {}}, | "entityLimitChangers": {"Foo": {}}, | ||||
researchQueued: {}, | "researchQueued": {}, | ||||
researchStarted: {}, | "researchStarted": {}, | ||||
researchedTechs: {}, | "researchedTechs": {}, | ||||
classCounts: {}, | "classCounts": {}, | ||||
typeCountsByClass: {}, | "typeCountsByClass": {}, | ||||
canBarter: false, | "canBarter": false, | ||||
statistics: { | "statistics": { | ||||
unitsTrained: 10, | "resourcesGathered": { | ||||
unitsLost: 9, | "food": 100, | ||||
buildingsConstructed: 5, | "wood": 0, | ||||
buildingsCaptured: 7, | "metal": 0, | ||||
buildingsLost: 4, | "stone": 0, | ||||
civCentresBuilt: 1, | "vegetarianFood": 0, | ||||
resourcesGathered: { | }, | ||||
food: 100, | "percentMapExplored": 10 | ||||
wood: 0, | |||||
metal: 0, | |||||
stone: 0, | |||||
vegetarianFood: 0, | |||||
}, | }, | ||||
treasuresCollected: 0, | "sequences": { | ||||
lootCollected: 0, | "unitsTrained": [0, 10], | ||||
percentMapExplored: 10, | "unitsLost": [0, 42], | ||||
teamPercentMapExplored: 10, | "buildingsConstructed": [1, 3], | ||||
percentMapControlled: 10, | "buildingsCaptured": [3, 7], | ||||
teamPercentMapControlled: 10, | "buildingsLost": [3, 10], | ||||
peakPercentOfMapControlled: 10, | "civCentresBuilt": [4, 10], | ||||
teamPeakPercentOfMapControlled: 10 | "resourcesGathered": { | ||||
"food": [5, 100], | |||||
"wood": [0, 0], | |||||
"metal": [0, 0], | |||||
"stone": [0, 0], | |||||
"vegetarianFood": [0, 0], | |||||
}, | |||||
"treasuresCollected": [1, 20], | |||||
"lootCollected": [0, 2], | |||||
"percentMapExplored": [0, 10], | |||||
Done Inline ActionsQuote all of that, because the objects properties ought to have those quotes and since those are not individual lines changed but entire paragraphs. The other ones not changed can remain as an incentive to add them and the diff fixing the rest will become much smaller. elexis: Quote all of that, because the objects properties ought to have those quotes and since those… | |||||
"teamPercentMapExplored": [0, 10], | |||||
"percentMapControlled": [0, 10], | |||||
"teamPercentMapControlled": [0, 10], | |||||
"peakPercentOfMapControlled": [0, 10], | |||||
"teamPeakPercentOfMapControlled": [0, 10] | |||||
}, | }, | ||||
}, | }, | ||||
{ | { | ||||
name: "Player 2", | "name": "Player 2", | ||||
civ: "mace", | "civ": "mace", | ||||
color: { r:1, g:0, b:0, a:1 }, | "color": { "r":1, "g":0, "b":0, "a":1 }, | ||||
controlsAll: true, | "controlsAll": true, | ||||
popCount: 40, | "popCount": 40, | ||||
popLimit: 30, | "popLimit": 30, | ||||
popMax: 300, | "popMax": 300, | ||||
panelEntities: [], | "panelEntities": [], | ||||
resourceCounts: { food: 200 }, | "resourceCounts": { "food": 200 }, | ||||
trainingBlocked: false, | "trainingBlocked": false, | ||||
state: "active", | "state": "active", | ||||
team: -1, | "team": -1, | ||||
teamsLocked: false, | "teamsLocked": false, | ||||
cheatsEnabled: false, | "cheatsEnabled": false, | ||||
disabledTemplates: {}, | "disabledTemplates": {}, | ||||
disabledTechnologies: {}, | "disabledTechnologies": {}, | ||||
hasSharedDropsites: false, | "hasSharedDropsites": false, | ||||
hasSharedLos: false, | "hasSharedLos": false, | ||||
spyCostMultiplier: 1, | "spyCostMultiplier": 1, | ||||
phase: "village", | "phase": "village", | ||||
isAlly: [true, true], | "isAlly": [true, true], | ||||
isMutualAlly: [false, false], | "isMutualAlly": [false, false], | ||||
isNeutral: [false, false], | "isNeutral": [false, false], | ||||
isEnemy: [false, false], | "isEnemy": [false, false], | ||||
entityLimits: {"Bar": 20}, | "entityLimits": {"Bar": 20}, | ||||
entityCounts: {"Bar": 0}, | "entityCounts": {"Bar": 0}, | ||||
entityLimitChangers: {"Bar": {}}, | "entityLimitChangers": {"Bar": {}}, | ||||
researchQueued: {}, | "researchQueued": {}, | ||||
researchStarted: {}, | "researchStarted": {}, | ||||
researchedTechs: {}, | "researchedTechs": {}, | ||||
classCounts: {}, | "classCounts": {}, | ||||
typeCountsByClass: {}, | "typeCountsByClass": {}, | ||||
canBarter: false, | "canBarter": false, | ||||
statistics: { | "statistics": { | ||||
unitsTrained: 10, | "resourcesGathered": { | ||||
unitsLost: 9, | "food": 100, | ||||
buildingsConstructed: 5, | "wood": 0, | ||||
buildingsCaptured: 7, | "metal": 0, | ||||
buildingsLost: 4, | "stone": 0, | ||||
civCentresBuilt: 1, | "vegetarianFood": 0, | ||||
resourcesGathered: { | |||||
food: 100, | |||||
wood: 0, | |||||
metal: 0, | |||||
stone: 0, | |||||
vegetarianFood: 0, | |||||
}, | }, | ||||
treasuresCollected: 0, | "percentMapExplored": 10 | ||||
lootCollected: 0, | }, | ||||
percentMapExplored: 10, | "sequences": { | ||||
teamPercentMapExplored: 10, | "unitsTrained": [0, 10], | ||||
percentMapControlled: 10, | "unitsLost": [0, 9], | ||||
teamPercentMapControlled: 10, | "buildingsConstructed": [0, 5], | ||||
peakPercentOfMapControlled: 10, | "buildingsCaptured": [0, 7], | ||||
teamPeakPercentOfMapControlled: 10 | "buildingsLost": [0, 4], | ||||
"civCentresBuilt": [0, 1], | |||||
"resourcesGathered": { | |||||
"food": [0, 100], | |||||
"wood": [0, 0], | |||||
"metal": [0, 0], | |||||
"stone": [0, 0], | |||||
"vegetarianFood": [0, 0], | |||||
}, | |||||
"treasuresCollected": [0, 0], | |||||
"lootCollected": [0, 0], | |||||
"percentMapExplored": [0, 10], | |||||
"teamPercentMapExplored": [0, 10], | |||||
"percentMapControlled": [0, 10], | |||||
"teamPercentMapControlled": [0, 10], | |||||
"peakPercentOfMapControlled": [0, 10], | |||||
"teamPeakPercentOfMapControlled": [0, 10] | |||||
}, | }, | ||||
} | } | ||||
], | ], | ||||
circularMap: false, | "circularMap": false, | ||||
timeElapsed: 0, | "timeElapsed": 0, | ||||
gameType: "conquest", | "gameType": "conquest", | ||||
alliedVictory: false, | "alliedVictory": false, | ||||
"barterPrices": { | "barterPrices": { | ||||
"buy": { "food": 150 }, | "buy": { "food": 150 }, | ||||
"sell": { "food": 25 } | "sell": { "food": 25 } | ||||
}, | }, | ||||
"resources": { | "resources": { | ||||
"codes": ["food", "metal", "stone", "wood"], | "codes": ["food", "metal", "stone", "wood"], | ||||
"names": { | "names": { | ||||
"food": "Food", | "food": "Food", | ||||
Show All 17 Lines | AddMock(10, IID_Builder, { | ||||
}, | }, | ||||
}); | }); | ||||
AddMock(10, IID_Health, { | AddMock(10, IID_Health, { | ||||
GetHitpoints: function() { return 50; }, | GetHitpoints: function() { return 50; }, | ||||
GetMaxHitpoints: function() { return 60; }, | GetMaxHitpoints: function() { return 60; }, | ||||
IsRepairable: function() { return false; }, | IsRepairable: function() { return false; }, | ||||
IsUnhealable: function() { return false; }, | IsUnhealable: function() { return false; }, | ||||
IsUndeletable: function() { return false; }, | IsUndeletable: function() { return false; }, | ||||
Done Inline Actions? bb: ? | |||||
}); | }); | ||||
AddMock(10, IID_Identity, { | AddMock(10, IID_Identity, { | ||||
GetClassesList: function() { return ["class1", "class2"]; }, | GetClassesList: function() { return ["class1", "class2"]; }, | ||||
GetVisibleClassesList: function() { return ["class3", "class4"]; }, | GetVisibleClassesList: function() { return ["class3", "class4"]; }, | ||||
GetRank: function() { return "foo"; }, | GetRank: function() { return "foo"; }, | ||||
GetSelectionGroupName: function() { return "Selection Group Name"; }, | GetSelectionGroupName: function() { return "Selection Group Name"; }, | ||||
HasClass: function() { return true; }, | HasClass: function() { return true; }, | ||||
Done Inline Actions? bb: ? | |||||
}); | }); | ||||
AddMock(10, IID_Position, { | AddMock(10, IID_Position, { | ||||
GetTurretParent: function() {return INVALID_ENTITY;}, | GetTurretParent: function() {return INVALID_ENTITY;}, | ||||
GetPosition: function() { | GetPosition: function() { | ||||
return {x:1, y:2, z:3}; | return {x:1, y:2, z:3}; | ||||
}, | }, | ||||
GetRotation: function() { | GetRotation: function() { | ||||
return {x:4, y:5, z:6}; | return {x:4, y:5, z:6}; | ||||
}, | }, | ||||
IsInWorld: function() { | IsInWorld: function() { | ||||
return true; | return true; | ||||
}, | }, | ||||
Done Inline Actions? bb: ? | |||||
}); | }); | ||||
AddMock(10, IID_ResourceTrickle, { | AddMock(10, IID_ResourceTrickle, { | ||||
"GetTimer": () => 1250, | "GetTimer": () => 1250, | ||||
"GetRates": () => ({ | "GetRates": () => ({ | ||||
"food": 2, | "food": 2, | ||||
"wood": 3, | "wood": 3, | ||||
"stone": 5, | "stone": 5, | ||||
▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
?