Added support for VASSAL 3.5.5 and VASL 6.6.2.

master
Pacman Ghost 3 years ago
parent 4c07d279da
commit f414a758a0
  1. 0
      vasl_templates/webapp/data/vasl-6.6.0/expected-multiple-images.json
  2. 0
      vasl_templates/webapp/data/vasl-6.6.0/online-counter-images.json
  3. 0
      vasl_templates/webapp/data/vasl-6.6.0/vasl-overrides.json
  4. 37
      vasl_templates/webapp/data/vasl-6.6.1/expected-multiple-images.json
  5. 30
      vasl_templates/webapp/data/vasl-6.6.1/online-counter-images.json
  6. 158
      vasl_templates/webapp/data/vasl-6.6.1/vasl-overrides.json
  7. 43
      vasl_templates/webapp/data/vasl-6.6.2/expected-multiple-images.json
  8. 2
      vasl_templates/webapp/data/vasl-6.6.2/online-counter-images.json
  9. 147
      vasl_templates/webapp/data/vasl-6.6.2/vasl-overrides.json
  10. 13
      vasl_templates/webapp/static/help/index.html
  11. 1363
      vasl_templates/webapp/tests/fixtures/vasl-pieces-6.6.2.txt
  12. 1237
      vasl_templates/webapp/tests/fixtures/vasl-pieces-legacy.txt
  13. 73
      vasl_templates/webapp/tests/test_counters.py
  14. 4
      vasl_templates/webapp/tests/test_files.py
  15. 2
      vasl_templates/webapp/tests/test_scenario_search.py
  16. 22
      vasl_templates/webapp/tests/test_vassal.py
  17. 16
      vasl_templates/webapp/vasl_mod.py
  18. 23
      vasl_templates/webapp/vassal.py
  19. 4
      vasl_templates/webapp/vo.py

@ -0,0 +1,37 @@
{
"1555": {
"name": "2pdr Portee",
"front_images": [ "br/vehicles/portee.gif", "br/vehicles/portee0.gif" ],
"back_images": null
},
"2212": {
"name": "76* INF FRC",
"front_images": [ "al/gun/alINF76.gif", "al/gun/alINF76u.gif" ],
"back_images": "al/gun/alINF76b.gif"
},
"adf:1828": {
"name": "105 ART wz.29",
"front_images": "po/gun/poARTwz29-BFP.png",
"back_images": [ "po/gun/poARTwz29-BFP.png", "po/gun/poARTwz29-BFPb.png" ]
},
"adf:1829": {
"name": "120* ART wz09.31",
"front_images": "po/gun/poARTwz0931-BFP.png",
"back_images": [ "po/gun/poARTwz0931-BFP.png", "po/gun/poARTwz0931-BFPb.png" ]
},
"adf:1830": {
"name": "155 ART wz.17",
"front_images": "po/gun/poARTwz17-BFP.png",
"back_images": [ "po/gun/poARTwz17-BFP.png", "po/gun/poARTwz17-BFPb.png" ]
},
"3b5:3676": {
"name": "M19A1 MGMC",
"front_images": [ "us/veh/usM19A1MGMC(trailer)KFW.png", "us/veh/usM19A1MGMC(KFW).png" ],
"back_images": null
}
}

@ -0,0 +1,30 @@
{
"1413": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/br/vehicles/morris.gif",
"2241": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/al/veh/FT17C.gif",
"6849": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/veh/fiT-50r.png",
"7418": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/ru/veh/T28M34L.gif",
"7420": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/ru/veh/T28EM40L.gif",
"7423/0": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/ru/veh/Lee(a)RU.gif",
"7428/0": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/ru/veh/ruM3A1 SC UA.gif",
"7432/0": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/ru/veh/RU VALVnoaa.gif",
"7434/0": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/ru/veh/RU VALV.gif",
"6765": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi81mmMTR.png",
"6782": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi81mmMTR Savu.png",
"6796": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi7.62AA.png",
"6797": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi20L4.png",
"6801": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi20L6.png",
"6806": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi120MTR.png",
"6808": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi20LAT.gif",
"6810": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi25LLAT.png",
"6811": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi37LAT.png",
"6812": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi37LAT H.png",
"6813": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi45LAT.png",
"6814": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi50LAT.png",
"6816": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi75LAT.png",
"6818": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi76INF.png",
"6820": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fi76ART.png",
"7409": "https://raw.githubusercontent.com/vasl-developers/vasl/develop/dist/images/fi/gun/fiAA76L.png"
}

@ -0,0 +1,158 @@
{
"2474": {
"expected": {
"name": "Goliath",
"front_images": [ "ge/gegol.gif", "ge/gegolb.gif" ],
"back_images": null
},
"updated": {
"front_images": "ge/gegol.gif"
}
},
"1555": {
"expected": {
"name": "2pdr Portee",
"front_images": "br/vehicles/portee.gif",
"back_images": [ "br/vehicles/portee.gif", "br/vehicles/portee0.gif" ]
},
"updated": {
"front_images": [ "br/vehicles/portee.gif", "br/vehicles/portee0.gif" ],
"back_images": null
}
},
"3463": {
"expected": {
"name": "75L AA 75/46",
"front_images": [ "it/gun/itAA7546.gif", "it/gun/itAA7546b.gif" ],
"back_images": [ "it/gun/itAA7546b.gif", "it/gun/itAA7546lb.gif" ]
},
"updated": {
"front_images": "it/gun/itAA7546.gif",
"back_images": "it/gun/itAA7546b.gif"
}
},
"3776": {
"expected": {
"name": "37* INF Skoda IG",
"front_images": [ "ax/gun/buIN37s.gif", "ax/gun/buIN37s2.gif" ],
"back_images": "ax/gun/buIN37sb.gif"
},
"updated": {
"front_images": "ax/gun/buIN37s.gif"
}
},
"3777": {
"expected": {
"name": "70* INF Skoda IG",
"front_images": [ "ax/gun/buIN37s.gif", "ax/gun/buIN37s2.gif" ],
"back_images": "ax/gun/buIN37sb.gif"
},
"updated": {
"front_images": "ax/gun/buIN37s2.gif"
}
},
"6802": {
"expected": {
"name": "20L (4) AA",
"front_images": [ "fi/gun/fi20L4 _2.png", "fi/gun/fi20L4 _2 LIM.png" ],
"back_images": null
},
"updated": {
"front_images": "fi/gun/fi20L4 _2.png"
}
},
"6803": {
"expected": {
"name": "20L VKT (12) AA",
"front_images": [ "fi/gun/fi20L12.png", "fi/gun/fi20L12L.png" ],
"back_images": null
},
"updated": {
"front_images": "fi/gun/fi20L12.png"
}
},
"6804": {
"expected": {
"name": "40L Bofors AA (s)",
"front_images": [ "fi/gun/fi40L.png", "fi/gun/fi40LL.png" ],
"back_images": null
},
"updated": {
"front_images": "fi/gun/fi40L.png"
}
},
"7409": {
"expected": {
"name": "76 ItK/28 B(s)",
"front_images": "fiAA76L.png",
"back_images": [ "fiAA76L.png", "fiAA76LB.png" ]
},
"updated": {
"back_images": "fiAA76LB.png"
}
},
"adf:1824": {
"expected": {
"name": "37L AT PTP obr. 30",
"front_images": "ru/gun/ruAT37L.gif",
"back_images": "ru/gun/ruAT37Lb.gif"
},
"updated": {
"front_images": "ru/gun/ru37LPTPobr30.png"
}
},
"adf:1822": {
"expected": {
"name": "37* INF PP obr. 15R",
"front_images": "ru/gun/ruINF37s.gif",
"back_images": "ru/gun/ruINF37sb.gif"
},
"updated": {
"front_images": "ru/gun/ru37PPobr15R.png"
}
},
"adf:1823": {
"expected": {
"name": "76* INF PP obr. 27",
"front_images": "ru/gun/ruINF76s.gif",
"back_images": "ru/gun/ruINF76sb.gif"
},
"updated": {
"front_images": "ru/gun/ru76PPobr27.png"
}
},
"3b5:10093": {
"expected": {
"name": "SL truck",
"front_images": [ "sh/SL3b(KFW).png", "sh/SL4b(KFW).png", "sh/SL5b(KFW).png", "sh/SL6b(KFW).png", "sh/SL1b(KFW).png", "sh/SL2b(KFW).png" ],
"back_images": [ "sh/SL3(KFW).png", "sh/SL4(KFW).png", "sh/SL5(KFW).png", "sh/SL6(KFW).png", "sh/SL1(KFW).png", "sh/SL2(KFW).png" ]
},
"updated": {
"front_images": "us/veh/usSearchlight(KFW).png",
"back_images": null
}
},
"08d:75": {
"expected": {
"name": "RCL 75*",
"front_images": "amrcl75-malf.png",
"back_images": "dm-75rcl.gif"
},
"updated": {
"front_images": "amrcl75.png"
}
}
}

@ -0,0 +1,43 @@
{
"1555": {
"name": "2pdr Portee",
"front_images": [ "br/vehicles/portee.gif", "br/vehicles/portee0.gif" ],
"back_images": null
},
"2212": {
"name": "76* INF FRC",
"front_images": [ "al/gun/alINF76.gif", "al/gun/alINF76u.gif" ],
"back_images": "al/gun/alINF76b.gif"
},
"7409": {
"name": "76 ItK/28 B(s)",
"front_images": "fi/gun/fiAA76L.png",
"back_images": [ "fi/gun/fiAA76L.png", "fi/gun/fiAA76LB.png" ]
},
"adf:1828": {
"name": "105 ART wz.29",
"front_images": "po/gun/poARTwz29-BFP.png",
"back_images": [ "po/gun/poARTwz29-BFP.png", "po/gun/poARTwz29-BFPb.png" ]
},
"adf:1829": {
"name": "120* ART wz09.31",
"front_images": "po/gun/poARTwz0931-BFP.png",
"back_images": [ "po/gun/poARTwz0931-BFP.png", "po/gun/poARTwz0931-BFPb.png" ]
},
"adf:1830": {
"name": "155 ART wz.17",
"front_images": "po/gun/poARTwz17-BFP.png",
"back_images": [ "po/gun/poARTwz17-BFP.png", "po/gun/poARTwz17-BFPb.png" ]
},
"3b5:3676": {
"name": "M19A1 MGMC",
"front_images": [ "us/veh/usM19A1MGMC(trailer)KFW.png", "us/veh/usM19A1MGMC(KFW).png" ],
"back_images": null
}
}

@ -0,0 +1,147 @@
{
"2474": {
"expected": {
"name": "Goliath",
"front_images": [ "ge/gegol.gif", "ge/gegolb.gif" ],
"back_images": null
},
"updated": {
"front_images": "ge/gegol.gif"
}
},
"1555": {
"expected": {
"name": "2pdr Portee",
"front_images": "br/vehicles/portee.gif",
"back_images": [ "br/vehicles/portee.gif", "br/vehicles/portee0.gif" ]
},
"updated": {
"front_images": [ "br/vehicles/portee.gif", "br/vehicles/portee0.gif" ],
"back_images": null
}
},
"3463": {
"expected": {
"name": "75L AA 75/46",
"front_images": [ "it/gun/itAA7546.gif", "it/gun/itAA7546b.gif" ],
"back_images": [ "it/gun/itAA7546b.gif", "it/gun/itAA7546lb.gif" ]
},
"updated": {
"front_images": "it/gun/itAA7546.gif",
"back_images": "it/gun/itAA7546b.gif"
}
},
"3776": {
"expected": {
"name": "37* INF Skoda IG",
"front_images": [ "ax/gun/buIN37s.gif", "ax/gun/buIN37s2.gif" ],
"back_images": "ax/gun/buIN37sb.gif"
},
"updated": {
"front_images": "ax/gun/buIN37s.gif"
}
},
"3777": {
"expected": {
"name": "70* INF Skoda IG",
"front_images": [ "ax/gun/buIN37s.gif", "ax/gun/buIN37s2.gif" ],
"back_images": "ax/gun/buIN37sb.gif"
},
"updated": {
"front_images": "ax/gun/buIN37s2.gif"
}
},
"6802": {
"expected": {
"name": "20L (4) AA",
"front_images": [ "fi/gun/fi20L4 _2.png", "fi/gun/fi20L4 _2 LIM.png" ],
"back_images": null
},
"updated": {
"front_images": "fi/gun/fi20L4 _2.png"
}
},
"6803": {
"expected": {
"name": "20L VKT (12) AA",
"front_images": [ "fi/gun/fi20L12.png", "fi/gun/fi20L12L.png" ],
"back_images": null
},
"updated": {
"front_images": "fi/gun/fi20L12.png"
}
},
"6804": {
"expected": {
"name": "40L Bofors AA (s)",
"front_images": [ "fi/gun/fi40L.png", "fi/gun/fi40LL.png" ],
"back_images": null
},
"updated": {
"front_images": "fi/gun/fi40L.png"
}
},
"adf:1824": {
"expected": {
"name": "37L AT PTP obr. 30",
"front_images": "ru/gun/ruAT37L.gif",
"back_images": "ru/gun/ruAT37Lb.gif"
},
"updated": {
"front_images": "ru/gun/ru37LPTPobr30.png"
}
},
"adf:1822": {
"expected": {
"name": "37* INF PP obr. 15R",
"front_images": "ru/gun/ruINF37s.gif",
"back_images": "ru/gun/ruINF37sb.gif"
},
"updated": {
"front_images": "ru/gun/ru37PPobr15R.png"
}
},
"adf:1823": {
"expected": {
"name": "76* INF PP obr. 27",
"front_images": "ru/gun/ruINF76s.gif",
"back_images": "ru/gun/ruINF76sb.gif"
},
"updated": {
"front_images": "ru/gun/ru76PPobr27.png"
}
},
"3b5:10093": {
"expected": {
"name": "SL truck",
"front_images": [ "sh/SL3b(KFW).png", "sh/SL4b(KFW).png", "sh/SL5b(KFW).png", "sh/SL6b(KFW).png", "sh/SL1b(KFW).png", "sh/SL2b(KFW).png" ],
"back_images": [ "sh/SL3(KFW).png", "sh/SL4(KFW).png", "sh/SL5(KFW).png", "sh/SL6(KFW).png", "sh/SL1(KFW).png", "sh/SL2(KFW).png" ]
},
"updated": {
"front_images": "us/veh/usSearchlight(KFW).png",
"back_images": null
}
},
"08d:75": {
"expected": {
"name": "RCL 75*",
"front_images": "amrcl75-malf.png",
"back_images": "dm-75rcl.gif"
},
"updated": {
"front_images": "amrcl75.png"
}
}
}

@ -82,9 +82,12 @@ and then connect to it in a browser at <tt>http://localhost:5010</tt>.
<p> If you have Docker installed, the webapp can be run in a container e.g.
<div class="code">
./run-container.sh --port 5010 \
--vasl-vmod ~/vasl/vasl-6.6.1.vmod \
./run-container.sh \
--port 5010 \
--vassal ~/vassal-3.5.5/ \
--vasl ~/vasl/vasl-6.6.2.vmod \
--vasl-extensions ~/vasl/extensions/ \
--boards ~/vasl/boards/ \
--chapter-h ~/vasl/chapter-h/ \
--user-files ~/vasl/user-files/
</div>
@ -141,11 +144,11 @@ Configuring the program
<p> Choose <em>Settings</em> from the <em>File</em> menu and configure the highlighted settings. As a guide, here are some example settings:
<table class="settings">
<tr> <td class="key"> VASSAL installation: </td> <td class="val"> <nobr>C:\Program Files\VASSAL-3.4.6\</nobr>
<tr> <td class="key"> VASL module: </td> <td class="val"> <nobr>C:\bin\vasl\vasl-6.6.1.vmod</nobr>
<tr> <td class="key"> VASSAL installation: </td> <td class="val"> <nobr>C:\Program Files\VASSAL-3.5.5\</nobr>
<tr> <td class="key"> VASL module: </td> <td class="val"> <nobr>C:\bin\vasl\vasl-6.6.2.vmod</nobr>
<tr> <td class="key"> VASL extensions: </td> <td class="val"> <nobr>C:\bin\vasl\extensions\</nobr>
<tr> <td class="key"> VASL boards: </td> <td class="val"> <nobr>C:\bin\vasl\boards\</nobr>
<tr> <td class="key" valign="top"> Java: </td> <td class="val"> <nobr>C:\Program Files\VASSAL-3.4.6\jre\bin\java.exe</nobr>
<tr> <td class="key" valign="top"> Java: </td> <td class="val"> <nobr>C:\Program Files\VASSAL-3.5.5\jre\bin\java.exe</nobr>
<div class="hint"> Leave this field blank to use the Java that comes with VASSAL (Windows only), or on your PATH. </div>
<tr> <td class="key"> Web driver: </td> <td class="val"> <nobr>C:\bin\geckodriver.exe</nobr>
</table>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -10,14 +10,11 @@ import pytest
from vasl_templates.webapp.vassal import SUPPORTED_VASSAL_VERSIONS
from vasl_templates.webapp.vasl_mod import get_vo_gpids, SUPPORTED_VASL_MOD_VERSIONS
from vasl_templates.webapp.vo import _kfw_listings #pylint: disable=protected-access
from vasl_templates.webapp.utils import compare_version_strings
from vasl_templates.webapp.tests import pytest_options
from vasl_templates.webapp.tests.utils import init_webapp, select_tab, find_child, find_children
from vasl_templates.webapp.tests.test_scenario_persistence import load_scenario
_EXPECTED_MISSING_GPIDS_EXCEPTIONS = [ "6.5.0", "6.5.1", "6.6.0", "6.6.1" ]
# ---------------------------------------------------------------------
@pytest.mark.skipif( pytest_options.short_tests, reason="--short-tests specified" )
@ -39,7 +36,7 @@ def test_counter_images( webapp, webdriver ): #pylint: disable=too-many-locals
except urllib.error.HTTPError as ex:
resp_code = ex.code
resp_data = None
assert locals()["check_"+side]( gpid, resp_code, resp_data )
assert locals()["check_"+side]( resp_code, resp_data )
# test counter images when no VASL module has been configured
webapp.control_tests.set_vasl_version( None, None )
@ -50,54 +47,13 @@ def test_counter_images( webapp, webdriver ): #pylint: disable=too-many-locals
fname = os.path.join( os.path.split(__file__)[0], "../static/images/missing-image.png" )
missing_image_data = open( fname, "rb" ).read()
check_images( gpids,
check_front = lambda gpid,code,data: code == 200 and data == missing_image_data,
check_back = lambda gpid,code,data: code == 200 and data == missing_image_data
check_front = lambda code, data: code == 200 and data == missing_image_data,
check_back = lambda code, data: code == 200 and data == missing_image_data
)
# FUDGE! 6.5.0 introduced a lot of new counters for K:FW. The vehicle/ordnance entries for these
# will always be loaded, but if an older version of VASL has been configured, requests to get images
# for these counters will, of course, fail, since the new counters won't be in the older VASL modules.
# We figure out here what those GPID's are.
# NOTE: All of this is horrendously complicated, and the problem will re-appear if new counters
# are added to the core VASL module in the future. At that point, we should probably drop testing
# against older versions of VASL and just test against the latest version :-/
expected_missing_gpids = set()
for vo_type in ("vehicles","ordnance"):
kfw_listings = _kfw_listings[ vo_type ]
for entries in kfw_listings.values():
for entry in entries:
if isinstance( entry["gpid"], list ):
expected_missing_gpids.update( entry["gpid"] )
else:
expected_missing_gpids.add( entry["gpid"] )
expected_missing_gpids = set( str(e) for e in expected_missing_gpids )
# NOTE: However, some of the GPID's used by the new K:FW counters use old images that are available
# even in older versions of VASL, so we figure out here what those are.
def get_gpids( fname ):
"""Extract the GPID's from the specified file."""
dname = os.path.join( os.path.split(__file__)[0], "fixtures" )
fname = os.path.join( dname, fname )
gpids = set()
for line_buf in open(fname,"r"):
mo = re.search( "^[0-9a-z:]+", line_buf )
if mo:
gpids.add( mo.group() )
return gpids
legacy_gpids = get_gpids( "vasl-pieces-legacy.txt" )
latest_gpids = get_gpids( "vasl-pieces-6.5.1.txt" )
common_gpids = legacy_gpids.intersection( latest_gpids )
expected_missing_gpids = expected_missing_gpids.difference( common_gpids )
expected_missing_gpids.remove( "1002" ) # FUDGE! this is a remapped GPID (11340)
expected_missing_gpids.remove( "1527" ) # FUDGE! this is a remapped GPID (12730)
vasl_version = None
def _do_check_front( gpid, code, data ):
if vasl_version not in _EXPECTED_MISSING_GPIDS_EXCEPTIONS and gpid in expected_missing_gpids:
return code == 404 and not data
def _do_check_front( code, data ):
return code == 200 and data
def _do_check_back( gpid, code, data ):
if vasl_version not in _EXPECTED_MISSING_GPIDS_EXCEPTIONS and gpid in expected_missing_gpids:
return code == 404 and not data
def _do_check_back( code, data ):
return (code == 200 and data) or (code == 404 and not data)
# initialize
@ -120,10 +76,7 @@ def test_counter_images( webapp, webdriver ): #pylint: disable=too-many-locals
init_webapp( webapp, webdriver )
# figure out what we're expecting to see
# NOTE: The results were the same across 6.4.0-6.4.4, but 6.5.0 introduced some changes.
fname = os.path.join( check_dir, "vasl-pieces-{}.txt".format( vasl_version ) )
if not os.path.isfile( fname ):
fname = os.path.join( check_dir, "vasl-pieces-legacy.txt" )
expected_vasl_pieces = open( fname, "r" ).read()
# generate a report for the pieces loaded
@ -148,7 +101,10 @@ def test_counter_images( webapp, webdriver ): #pylint: disable=too-many-locals
# ---------------------------------------------------------------------
def test_gpid_remapping( webapp, webdriver ):
# NOTE: We disabled this test since we no longer support older versions of VASSAL+VASL, and the later versions
# don't require GPID remapping, but we leave the code here in case we need it again in the future.
def _DISABLED_test_gpid_remapping( webapp, webdriver ):
"""Test GPID remapping."""
# initialize
@ -223,12 +179,13 @@ def test_compare_version_strings():
"""Test comparing version strings."""
# test comparing VASSAL version strings
for i,vassal_version in enumerate( SUPPORTED_VASSAL_VERSIONS):
vassal_versions = list( SUPPORTED_VASSAL_VERSIONS.keys() )
for i,vassal_version in enumerate( vassal_versions ):
if i > 0:
assert compare_version_strings( SUPPORTED_VASSAL_VERSIONS[i-1], vassal_version ) < 0
assert compare_version_strings( SUPPORTED_VASSAL_VERSIONS[i], vassal_version ) == 0
if i < len(SUPPORTED_VASSAL_VERSIONS)-1:
assert compare_version_strings( vassal_version, SUPPORTED_VASSAL_VERSIONS[i+1] ) < 0
assert compare_version_strings( vassal_versions[i-1], vassal_version ) < 0
assert compare_version_strings( vassal_versions[i], vassal_version ) == 0
if i < len(vassal_versions)-1:
assert compare_version_strings( vassal_version, vassal_versions[i+1] ) < 0
# test comparing VASL version strings
for i,vasl_version in enumerate(SUPPORTED_VASL_MOD_VERSIONS):

@ -115,10 +115,10 @@ def test_local_user_files( webapp, webdriver ):
assert ex.code == 404
# try getting a file outside the configured directory (nb: should always fail)
fname = os.path.join( os.path.split(__file__)[0], "fixtures/vasl-pieces-legacy.txt" )
fname = os.path.join( os.path.split(__file__)[0], "fixtures/new-default-scenario.json" )
assert os.path.isfile( fname )
with pytest.raises( urllib.error.HTTPError ) as exc_info:
url = webapp.url_for( "get_user_file", path="../vasl-pieces-legacy.txt" )
url = webapp.url_for( "get_user_file", path="../new-default-scenario.json" )
resp = urllib.request.urlopen( url )
assert exc_info.value.code == 404

@ -616,7 +616,7 @@ def test_scenario_upload( webapp, webdriver ):
set_stored_msg( "_vsav-persistence_", base64.b64encode( vsav_data ).decode( "utf-8" ) )
find_child( ".vsav-container", dlg ).click()
# wait for the files to be prepared
wait_for( 30,
wait_for( 60,
lambda: "loader.gif" not in find_child( ".screenshot-container .preview img" ).get_attribute( "src" )
)

@ -7,6 +7,7 @@ import base64
import random
import typing.re #pylint: disable=import-error
from vasl_templates.webapp.vassal import VassalShim
from vasl_templates.webapp.utils import TempFile, change_extn, compare_version_strings
from vasl_templates.webapp.tests import pytest_options
from vasl_templates.webapp.tests.utils import \
@ -509,7 +510,7 @@ def test_update_legacy_latw_labels( webapp, webdriver ):
# run the test against all versions of VASSAL+VASL
run_vassal_tests( webapp, do_test )
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ---------------------------------------------------------------------
def test_player_owned_labels( webapp, webdriver ):
"""Test how we update labels owned by different player nationalities."""
@ -668,7 +669,7 @@ def test_analyze_vsav_hip_concealed( webapp, webdriver ):
# run the test against all versions of VASSAL+VASL
run_vassal_tests( webapp, do_test )
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ---------------------------------------------------------------------
def test_reverse_remapped_gpids( webapp, webdriver ):
"""Test reverse mapping of GPID's."""
@ -692,7 +693,7 @@ def test_reverse_remapped_gpids( webapp, webdriver ):
# run the test against all versions of VASSAL+VASL
run_vassal_tests( webapp, do_test, min_vasl_version="6.5.0" )
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# ---------------------------------------------------------------------
def test_vo_entry_selection_for_theater( webapp, webdriver ):
"""Test selection of vehicle/ordnance entries by theater."""
@ -749,17 +750,6 @@ def run_vassal_tests( webapp, func, all_combos=None, min_vasl_version=None, vasl
vassal_versions = webapp.control_tests.get_vassal_versions()
vasl_versions = webapp.control_tests.get_vasl_versions()
def is_valid_combo( vassal_version, vasl_version ):
"""Check if this is a valid combination of VASSAL and VASL."""
# NOTE: From 3.3, VASSAL requires VASL 6.6.0 or later (and no longer works with Java 8).
if compare_version_strings( vassal_version, "3.3.0" ) >= 0:
if compare_version_strings( vasl_version, "6.6.0" ) < 0:
return False
else:
if compare_version_strings( vasl_version, "6.6.0" ) >= 0:
return False
return True
# check if we want to test all VASSAL+VASL combinations (nb: if not, we test against only one combination,
# and since they all should give the same results, it doesn't matter which one.
if all_combos is None:
@ -768,7 +758,7 @@ def run_vassal_tests( webapp, func, all_combos=None, min_vasl_version=None, vasl
for _ in range(0,100):
vasl_version = random.choice( vasl_versions )
vassal_version = random.choice( vassal_versions )
if is_valid_combo( vassal_version, vasl_version ):
if VassalShim.is_compatible_version( vassal_version, vasl_version ):
vasl_versions = [ vasl_version ]
vassal_versions = [ vassal_version ]
break
@ -780,7 +770,7 @@ def run_vassal_tests( webapp, func, all_combos=None, min_vasl_version=None, vasl
for vasl_version in vasl_versions:
if min_vasl_version and compare_version_strings( vasl_version, min_vasl_version ) < 0:
continue
if not is_valid_combo( vassal_version, vasl_version ):
if not VassalShim.is_compatible_version( vassal_version, vasl_version ):
continue
webapp.control_tests \
.set_vassal_version( vassal_version ) \

@ -16,8 +16,8 @@ from vasl_templates.webapp.config.constants import DATA_DIR
from vasl_templates.webapp.vo import get_vo_listings
from vasl_templates.webapp.utils import compare_version_strings
SUPPORTED_VASL_MOD_VERSIONS = [ "6.6.0", "6.6.1" ]
SUPPORTED_VASL_MOD_VERSIONS_DISPLAY = "6.6.0-.1"
SUPPORTED_VASL_MOD_VERSIONS = [ "6.6.0", "6.6.1", "6.6.2" ]
SUPPORTED_VASL_MOD_VERSIONS_DISPLAY = "6.6.0-.2"
_zip_file_lock = threading.Lock()
@ -251,17 +251,17 @@ class VaslMod:
def _load_vmod( self, data_dir ): #pylint: disable=too-many-branches,too-many-locals
"""Load a VASL module file and any extensions."""
# load our overrides
fname = os.path.join( data_dir, "vasl-overrides.json" )
vasl_overrides = json.load( open( fname, "r", encoding="utf-8" ) )
fname = os.path.join( data_dir, "expected-multiple-images.json" )
expected_multiple_images = json.load( open( fname, "r", encoding="utf-8" ) )
# get the VASL version
build_info = self._files[0][0].read( "buildFile" )
doc = xml.etree.ElementTree.fromstring( build_info )
self.vasl_version = doc.attrib.get( "version" )
# load our overrides
fname = os.path.join( data_dir, "vasl-"+self.vasl_version, "vasl-overrides.json" )
vasl_overrides = json.load( open( fname, "r", encoding="utf-8" ) )
fname = os.path.join( data_dir, "vasl-"+self.vasl_version, "expected-multiple-images.json" )
expected_multiple_images = json.load( open( fname, "r", encoding="utf-8" ) )
# figure out which pieces we're interested in
target_gpids = get_vo_gpids( self )

@ -31,8 +31,15 @@ from vasl_templates.webapp.vasl_mod import get_reverse_remapped_gpid
# ------+------------------
# 6.6.0 | 3.4.2 14.0.2+12
# 6.6.1 | 3.4.6 15+36
SUPPORTED_VASSAL_VERSIONS = [ "3.4.2", "3.4.6" ]
SUPPORTED_VASSAL_VERSIONS_DISPLAY = "3.4.2, 3.4.6"
# 6.6.2 | 3.5.5 16+36
# NOTE: VASSAL+VASL back-compat has gone out the window :-/ We have to tie versions of VASL
# to specific versions of VASSAL. Sigh...
SUPPORTED_VASSAL_VERSIONS = {
"3.4.2": [ "6.6.0", "6.6.1" ],
"3.4.6": [ "6.6.0", "6.6.1" ],
"3.5.5": [ "6.6.0", "6.6.1", "6.6.2" ],
}
SUPPORTED_VASSAL_VERSIONS_DISPLAY = "3.4.2, 3.4.6, 3.5.5"
# ---------------------------------------------------------------------
@ -338,6 +345,11 @@ class VassalShim:
with open( temp_file.name, "r", encoding="utf-8" ) as fp:
return fp.read()
@staticmethod
def is_compatible_version( vassal_version, vasl_version ):
"""Check if the VASSAL+VASL versions are compatible."""
return vasl_version in SUPPORTED_VASSAL_VERSIONS.get( vassal_version, [] )
def dump_scenario( self, fname ):
"""Dump a scenario file."""
return self._run_vassal_shim( "dump", fname )
@ -537,6 +549,13 @@ class VassalShim:
"This program has not been tested with VASSAL {}.<p>Things might work, but they might not...",
version
)
elif globvars.vasl_mod:
if not VassalShim.is_compatible_version( version, globvars.vasl_mod.vasl_version ):
if msg_store:
msg_store.error(
"VASSAL {} and VASL {} are not compatible.".format( version, globvars.vasl_mod.vasl_version ),
version
)
@staticmethod
def _get_vassal_dir():

@ -186,7 +186,9 @@ def get_online_counter_images():
# There doesn't seem to be any pattern to these counters, and since there aren't too many of them,
# the most robust solution is probably to fix them up manually :-/
# NOTE: To check these: $/counter-image-urls.html?fetch-images=1
fname = os.path.join( DATA_DIR, "online-counter-images.json" )
if not globvars.vasl_mod:
return jsonify( {} )
fname = os.path.join( DATA_DIR, "vasl-"+globvars.vasl_mod.vasl_version, "online-counter-images.json" )
return send_file( fname, "application/json" )
# ---------------------------------------------------------------------

Loading…
Cancel
Save