forked from tobymao/18xx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add /tiles/test to easily reference tiles from different titles and g…
…ame states * can display a tile as it appears on the board at any given point in any given fixture * fixtures are processed to the specified action, and the select tiles are rendered * include tiles showing the problems reported in the following issues: * tobymao#4992 * tobymao#5153 * tobymao#5167 * tobymao#5673 * copy 18Mag fixture 76622 to a new fixture to reproduce * tobymao#5981 * tobymao#6604 * tobymao#7765 * tobymao#8178 * add completed 1868 Wyoming game as a fixture * 1846 and 1868 Wyoming tiles added here were used for the before/after screenshots in tobymao#9174 * move fixtures from `/spec/fixtures/` into `/public/fixtures/` so the JSON can be accessed via `/fixtures/<title>/<fixture_id>.json` * test cases defined in a location accessible by both the view code and server side code (`lib/engine/test_tiles.rb`) so that when the page is initially served up, it already includes the `<script>` tags for the games being tested * test cases need a `title`, can also have `title`, `fixture`, `action`, and any `kwargs` used by `render_tile_blocks`
- Loading branch information
Showing
203 changed files
with
250 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
# frozen_string_literal: true | ||
|
||
module Engine | ||
module TestTiles | ||
# each entry is a Hash containing: | ||
# - tile / hex id | ||
# - game title (optional) | ||
# - fixture (optional, requires game title; if not given, the starting state | ||
# of the hex/tile is used) | ||
# - action id (optional, requires fixture; if not given, the fixture is | ||
# processed to its conclusion) | ||
# - other kwargs for View::Tiles#render_tile_blocks | ||
TEST_TILES_HUMAN_READABLE = [ | ||
{ tile: '45' }, | ||
|
||
{ tile: 'H11', title: '1822PNW' }, | ||
{ tile: 'O8', title: '1822PNW' }, | ||
{ tile: 'I12', title: '1822PNW' }, | ||
|
||
# open: https://github.com/tobymao/18xx/issues/5981 | ||
{ tile: 'H22', title: '1828.Games' }, | ||
|
||
# open: https://github.com/tobymao/18xx/issues/8178 | ||
{ tile: 'H18', title: '1830', fixture: '26855', action: 385 }, | ||
|
||
{ tile: 'C15', title: '1846' }, | ||
|
||
# open: https://github.com/tobymao/18xx/issues/5167 | ||
{ tile: 'N11', title: '1856', fixture: 'hotseat005', action: 113 }, | ||
|
||
{ tile: 'L0', title: '1868 Wyoming' }, | ||
{ tile: 'WRC', title: '1868 Wyoming' }, | ||
{ tile: 'F12', title: '1868 Wyoming', fixture: '1868WY_5', action: 835 }, | ||
{ tile: 'L0', title: '1868 Wyoming', fixture: '1868WY_5', action: 835 }, | ||
{ tile: 'J12', title: '1868 Wyoming', fixture: '1868WY_5', action: 835 }, | ||
{ tile: 'J12', title: '1868 Wyoming', fixture: '1868WY_5' }, | ||
|
||
# open: https://github.com/tobymao/18xx/issues/4992 | ||
{ tile: 'I11', title: '1882', fixture: '5236', action: 303 }, | ||
|
||
# open: https://github.com/tobymao/18xx/issues/6604 | ||
{ tile: 'L41', title: '1888' }, | ||
|
||
# open: https://github.com/tobymao/18xx/issues/5153 | ||
{ tile: 'IR7', title: '18Ireland' }, | ||
{ tile: 'IR8', title: '18Ireland' }, | ||
|
||
# open: https://github.com/tobymao/18xx/issues/5673 | ||
{ tile: 'D19', title: '18Mag', fixture: 'hs_tfagolvf_76622' }, | ||
{ tile: 'I14', title: '18Mag', fixture: 'hs_tfagolvf_76622' }, | ||
|
||
# open: https://github.com/tobymao/18xx/issues/7765 | ||
{ tile: '470', title: '18MEX' }, | ||
{ tile: '475', title: '18MEX' }, | ||
{ tile: '479P', title: '18MEX' }, | ||
{ tile: '485P', title: '18MEX' }, | ||
{ tile: '486P', title: '18MEX' }, | ||
].freeze | ||
|
||
# rearrange the above to a structure that can be more efficiently iterated | ||
# over--each fixture only needs to be fetched once, and only needs to be | ||
# processed to each unique action once | ||
# | ||
# defining with this structure directly would confusing to read; for generic | ||
# tiles, all of the keys in the nested Hash would end up as `nil` | ||
TEST_TILES = | ||
TEST_TILES_HUMAN_READABLE.each_with_object({}) do |opts, test_tiles| | ||
tile = opts.delete(:tile) | ||
title = opts.delete(:title) | ||
fixture = opts.delete(:fixture) | ||
action = opts.delete(:action) | ||
|
||
test_tiles[title] ||= {} | ||
test_tiles[title][fixture] ||= {} | ||
test_tiles[title][fixture][action] ||= [] | ||
|
||
test_tiles[title][fixture][action] << [tile, opts] | ||
end.freeze | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"status":"active","actions":[{"type":"bid","entity":1355,"entity_type":"player","id":1,"created_at":1647183951,"minor":"1","price":0},{"type":"bid","entity":10497,"entity_type":"player","id":2,"created_at":1647183984,"minor":"6","price":0},{"type":"bid","entity":1423,"entity_type":"player","id":3,"created_at":1647184001,"minor":"3","price":0},{"type":"bid","entity":1443,"entity_type":"player","id":4,"created_at":1647184054,"corporation":"SKEV","price":0},{"type":"bid","entity":3510,"entity_type":"player","id":5,"created_at":1647184101,"minor":"12","price":0},{"type":"bid","entity":10497,"entity_type":"player","id":6,"created_at":1647184116,"minor":"2","price":0},{"type":"bid","entity":1423,"entity_type":"player","id":7,"created_at":1647184148,"corporation":"SKEV","price":0},{"type":"bid","entity":1443,"entity_type":"player","id":8,"created_at":1647184181,"minor":"4","price":0},{"type":"bid","entity":3510,"entity_type":"player","id":9,"created_at":1647184188,"corporation":"SNW","price":0},{"type":"bid","entity":1355,"entity_type":"player","id":10,"created_at":1647184217,"minor":"7","price":0},{"type":"bid","entity":1423,"entity_type":"player","id":11,"created_at":1647184273,"minor":"5","price":0},{"type":"bid","entity":1443,"entity_type":"player","id":12,"created_at":1647184287,"corporation":"LdStEG","price":0},{"type":"bid","entity":3510,"entity_type":"player","id":13,"created_at":1647184315,"minor":"10","price":0},{"type":"bid","entity":1355,"entity_type":"player","id":14,"created_at":1647184337,"corporation":"LdStEG","price":0},{"type":"bid","entity":10497,"entity_type":"player","id":15,"created_at":1647184346,"corporation":"SNW","price":0},{"type":"bid","entity":1443,"entity_type":"player","id":16,"created_at":1647184387,"minor":"9","price":0},{"type":"bid","entity":3510,"entity_type":"player","id":17,"created_at":1647184399,"corporation":"SIK","price":0},{"type":"bid","entity":1355,"entity_type":"player","id":18,"created_at":1647184495,"corporation":"SIK","price":0},{"type":"bid","entity":10497,"entity_type":"player","id":19,"created_at":1647184502,"corporation":"RABA","price":0},{"type":"bid","entity":1423,"entity_type":"player","id":20,"created_at":1647184546,"corporation":"G&C","price":0},{"hex":"D13","tile":"58-0","type":"lay_tile","entity":"1","rotation":0,"entity_type":"minor","id":21,"user":1355,"created_at":1647184614,"skip":true},{"hex":"E12","tile":"L33-0","type":"lay_tile","entity":"1","rotation":2,"entity_type":"minor","id":22,"user":1355,"created_at":1647184617,"skip":true},{"skip":true,"type":"undo","entity":"1","action_id":20,"entity_type":"minor","id":23,"user":1355,"created_at":1647184625},{"type":"lay_tile","entity":"1","entity_type":"minor","id":24,"created_at":1647184633,"hex":"E12","tile":"L33-0","rotation":2},{"type":"lay_tile","entity":"1","entity_type":"minor","id":25,"created_at":1647184636,"hex":"F13","tile":"6-0","rotation":0},{"type":"pass","entity":"1","entity_type":"minor","id":26,"created_at":1647184645},{"type":"pass","entity":"1","entity_type":"minor","id":27,"created_at":1647184655},{"type":"run_routes","entity":"1","entity_type":"minor","id":28,"created_at":1647184662,"routes":[{"train":"2-0","connections":[["F13","E12"]],"hexes":["E12","F13"],"revenue":50,"revenue_str":"E12-F13","subsidy":0,"nodes":["F13-0","E12-0"]}]},{"type":"pass","entity":"1","entity_type":"minor","id":29,"created_at":1647184669},{"hex":"D19","tile":"L32-0","type":"lay_tile","entity":"2","rotation":0,"entity_type":"minor","id":30,"user":10497,"created_at":1647184678,"skip":true},{"skip":true,"type":"undo","entity":"2","entity_type":"minor","id":31,"user":10497,"created_at":1647184692},{"hex":"D19","tile":"L32-0","type":"lay_tile","entity":"2","rotation":1,"entity_type":"minor","id":32,"user":10497,"created_at":1647184697,"skip":true},{"skip":true,"type":"undo","entity":"2","entity_type":"minor","id":33,"user":10497,"created_at":1647184701},{"type":"lay_tile","entity":"2","entity_type":"minor","id":34,"created_at":1647184715,"hex":"D19","tile":"L32-0","rotation":4},{"type":"undo","entity":"2","entity_type":"minor","id":35,"created_at":1683764194},{"type":"lay_tile","entity":"2","entity_type":"minor","id":36,"created_at":1683764197,"hex":"D19","tile":"L32-0","rotation":2},{"type":"pass","entity":"2","entity_type":"minor","id":37,"created_at":1683764204},{"type":"pass","entity":"2","entity_type":"minor","id":38,"created_at":1683764205},{"type":"pass","entity":"2","entity_type":"minor","id":39,"created_at":1683764206},{"type":"pass","entity":"3","entity_type":"minor","id":40,"created_at":1683764206},{"type":"pass","entity":"3","entity_type":"minor","id":41,"created_at":1683764207},{"type":"pass","entity":"3","entity_type":"minor","id":42,"created_at":1683764208},{"type":"pass","entity":"4","entity_type":"minor","id":43,"created_at":1683764210},{"type":"pass","entity":"4","entity_type":"minor","id":44,"created_at":1683764210},{"type":"pass","entity":"4","entity_type":"minor","id":45,"created_at":1683764211},{"type":"pass","entity":"5","entity_type":"minor","id":46,"created_at":1683764211},{"type":"pass","entity":"5","entity_type":"minor","id":47,"created_at":1683764212},{"type":"pass","entity":"5","entity_type":"minor","id":48,"created_at":1683764212},{"type":"pass","entity":"6","entity_type":"minor","id":49,"created_at":1683764213},{"type":"pass","entity":"6","entity_type":"minor","id":50,"created_at":1683764214},{"type":"pass","entity":"6","entity_type":"minor","id":51,"created_at":1683764214},{"type":"pass","entity":"7","entity_type":"minor","id":52,"created_at":1683764215},{"type":"pass","entity":"7","entity_type":"minor","id":53,"created_at":1683764215},{"type":"pass","entity":"7","entity_type":"minor","id":54,"created_at":1683764216},{"type":"lay_tile","entity":"9","entity_type":"minor","id":55,"created_at":1683764220,"hex":"I14","tile":"L32-1","rotation":1}, {"type": "end_game","entity": "9","entity_type": "minor","id": 56,"created_at": 1683774126}],"id":"hs_tfagolvf_76622","description":"Cloned from game 76622","user":{"id":0,"name":"You"},"players":[{"id":1355,"name":"hubbs"},{"id":10497,"name":"mnfuller"},{"id":1423,"name":"Breich"},{"id":1443,"name":"vexhawk"},{"id":3510,"name":"Harry"}],"max_players":5,"title":"18Mag","settings":{"seed":1382898850,"is_async":true,"unlisted":true,"auto_routing":true,"player_order":null,"optional_rules":[]},"user_settings":null,"turn":1,"round":"Operating Round","acting":[1443],"result":{"10497":140, "1355":155, "1423":145, "1443":135, "3510":140},"loaded":true,"created_at":"2023-05-10","updated_at":1683764220,"mode":"hotseat","manually_ended":null} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../public/fixtures |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters