Exemplo n.º 1
0
def test_dat_string_lengths():
    """No encyclopedia string should be longer than 68."""
    wb = load_workbook(DUMP_XLS)
    for sheet in ['SEND.DAT', 'SINKA.DAT']:
        ws = wb.get_sheet_by_name(sheet)
        new_offset = 0
        for index, row in enumerate(ws.rows[1:]):
            if row[4].value:
                assert onscreen_length(row[4].value) <= DAT_MAX_LENGTH, "In sheet %s, shorten string at row %s" % (sheet, index+2)
Exemplo n.º 2
0
def test_creature_string_lengths():
    """No creature name can have a name longer than 21."""
    wb = load_workbook(DUMP_XLS)
    for sheet in ['ST1.EXE', 'ST2.EXE', 'ST3.EXE', 'ST4.EXE', 'ST5.EXE', 'ST6.EXE']:
        creature_lo, creature_hi = CREATURE_BLOCK[sheet]
        ws = wb.get_sheet_by_name(sheet)
        new_offset = 0
        for index, row in enumerate(ws.rows[1:]):
            if int(row[0].value, 16) >= creature_lo and int(row[0].value, 16) <= creature_hi:
                if row[4].value:
                    assert onscreen_length(row[4].value) <= CREATURE_MAX_LENGTH, "In sheet %s, shorten string at row %s" % (sheet, index+2)
Exemplo n.º 3
0
def test_all_string_lengths():
    """Corasest string test. No string can be longer than 77."""
    wb = load_workbook(DUMP_XLS)
    sheets = wb.get_sheet_names()
    sheets.remove('ORIGINAL')
    sheets.remove('MISC TITLES')
    for sheet in sheets:
        ws = wb.get_sheet_by_name(sheet)
        new_offset = 0
        for index, row in enumerate(ws.rows[1:]):
            if row[4].value:
                print row[4].value
                if onscreen_length(row[4].value) > FULLSCREEN_MAX_LENGTH:
                    print "%s %s: %s has length %s" % (sheet, row[0].value, row[4].value, onscreen_length(row[4].value))
Exemplo n.º 4
0
def test_game_string_lengths():
    """
    Wide onscreen strings can't be more than 68? characters.
    Ones not marked as wide can't be more than 42 characters.
    """
    wb = load_workbook(DUMP_XLS)
    for sheet in ['ST1.EXE', 'ST2.EXE', 'ST3.EXE', 'ST4.EXE', 'ST5.EXE', 'ST5S1.EXE',
                  'ST5S2.EXE', 'ST5S3.EXE', "ST6.EXE"]:
        ws = wb.get_sheet_by_name(sheet)
        new_offset = 0
        for index, row in enumerate(ws.rows[1:]):
            if row[7].value:
                if row[7].value == 'wide':
                    if onscreen_length(row[4].value) > FULLSCREEN_MAX_LENGTH:
                        try:
                            print "%s %s: %s has length %s" % (sheet, row[0].value, row[4].value, onscreen_length(row[4].value))
                        except UnicodeDecodeError:
                            print "%s %s: %s has length %s" % (sheet, row[0].value, 'some string', onscreen_length(row[4].value))
            else:
                if onscreen_length(row[4].value) > DIALOGUE_MAX_LENGTH:
                    try:
                        print "%s %s: %s has length %s" % (sheet, row[0].value, row[4].value, onscreen_length(row[4].value))
                    except UnicodeDecodeError:
                        print "%s %s: %s has length %s" % (sheet, row[0].value, 'some string', onscreen_length(row[4].value))