Skip to main content

Test/TAS framework for DOSBox

Project description

TestBox

Test/TAS framework for DOSBox.

Run:

docker-compose -f docker-compose.example.yml run test

Or:

docker-compose -f docker-compose.example.console.yml run test

Tested on Ubuntu 20.10.

Example

As test application I used "demo" version of Soko-Ban by Spectrum HoloByte. Please notice that test application is only included as an example. It is unplayable after level 2.

Test scenario includes full walkthrough of level 1.

import testbox

with testbox.TestBox(['SOKOBAN.EXE'], {'cpu': {'cycles': 'max'}}) as box:
    box.wait_image('images/graphics.png', timeout=1)
    box.send_keys('C\r') # CGA mode.

    box.wait_image('images/input.png', timeout=1)
    box.send_keys('K\r') # Input from keyboard.

    box.wait_image('images/door.png', timeout=5)
    box.send_keys('\r') # Enter door.

    box.wait_image('images/lobby.png', timeout=1)
    box.send_keys('\r') # Enter elevator.

    box.wait_image('images/menu.png', timeout=5)
    box.send_keys('TEST\r') # Enter player name.

    box.wait_image('images/start.png', timeout=1)
    box.send_keys('\r') # Select single player mode.

    box.wait_image('images/elevator.png', timeout=1)
    box.send_keys('1A') # Select first floor and accept.

    for step, keys in (
        ('one', '▴◂◂◂▴▴▴◂▴◂◂▾◂◂▾▾▾▸▸▸▸▸▸▸▸▸▸▸▸▸▾▸▴◂◂'),
        ('two', '◂◂◂◂◂◂◂▴▴▴◂▴◂◂▾▾▾▴▴◂◂▾▾▾▸▸▸▸▸▸▸▸▸▸▸▸▴▸▾◂▾▸▴◂'),
        ('three', '◂◂◂◂◂◂◂▴▴▴◂◂▴◂▾▾▾▴▴◂◂▾▾▾▸▸▸▸▸▸▸▸▸▸▸▸▾▸▴◂'),
        ('four', '◂◂◂◂◂◂◂▴▴▴◂◂▴▴▴◂▾▾▾▾▾▴▴◂◂▾▾▾▸▸▸▸▸▸▸▸▸▸▸▴▸▾◂▾▸▴'),
        ('five', '◂◂◂◂◂◂◂▴▴▴◂◂▴▴▴▸▾▾◂◂▾◂◂▾▾◂◂▾▸▸▸▸▸▸▸▸▸▸▸▸▸▸▸◂'),
        ('six', '◂◂◂◂◂◂◂▴▴▴◂◂▴◂▾▾▾▴▴◂◂▾▾▾▸▸▸▸▸▸▸▸▸▸▸▸'),
    ):
        # Checkpoint, skipping status bar.
        box.wait_image(f'images/step-{step}.png', bbox=(0, 0, 320, 191), timeout=3)

        for key in keys:
            box.send_keys(key)
            # Waiting move counter to update.
            box.wait_change(bbox=(75, 191, 110, 200), timeout=1)

    box.wait_image('images/victory.png', timeout=10) # Level 2.

Test application

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testbox-1.0.4.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file testbox-1.0.4.tar.gz.

File metadata

  • Download URL: testbox-1.0.4.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for testbox-1.0.4.tar.gz
Algorithm Hash digest
SHA256 bfc979f0e0c949a0dca23bdf9e4f9a1b79d0677ee98fae16fce93502c6bcdb34
MD5 513043ec771d5504f41bed27d4775c0f
BLAKE2b-256 8cfb57ea979768ee7efa880bda0ca26293eea7e377a1fd0be660182dbe1e1788

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page