def test_autoexec_cmds_and_conf(self): os.chdir('tests/files/confs') cfg = confgen.DosboxConfiguration(conf_files=['c1.conf'], commands=['cmd1', 'cmd2']) self.assertIn('autoexec', cfg.sections()) self.assertEqual(cfg['autoexec'], ['echo c1', 'cmd1', 'cmd2'])
def test_update_sections(self): os.chdir('tests/files/confs') cfg = confgen.DosboxConfiguration(conf_files=['sb1.conf', 'sb2.conf']) self.assertIn('sblaster', cfg.sections()) self.assertIn('mixer', cfg.sections()) self.assertEqual('44100', cfg['mixer']['rate']) # from sb2.conf self.assertEqual('77', cfg['sblaster']['irq']) # from sb2.conf self.assertEqual('42', cfg['sblaster']['dma']) # from sb1.conf
def test_autoexec_cmds_and_exe(self): os.chdir('tests/files/no_conf') cfg = confgen.DosboxConfiguration(exe='FILE.EXE', commands=['cmd1', 'cmd2']) self.assertIn('autoexec', cfg.sections()) self.assertEqual(cfg['autoexec'], ['cmd1', 'cmd2', 'mount C .', 'C:', 'file.exe'])
def test_gog_warcraft(self): os.chdir('tests/files/gog/warcraft_orcs_and_humans/DOSBOX') cmd_line = ['-conf', '..\\dosbox_warcraft.conf', '-conf', '..\\dosbox_warcraft_single.conf', '-noconsole', '-c', 'exit'] args = confgen.parse_dosbox_arguments(cmd_line) conf = confgen.DosboxConfiguration(conf_files=(args.conf or []), commands=args.c, exe=args.file, noautoexec=args.noautoexec, exit_after_exe=args.exit) # at the very least, autoexec should be filled self.assertEqual(conf.encoding, 'cp1250')
def test_autoexec_from_conf_3(self): os.chdir('tests/files/confs') cfg = confgen.DosboxConfiguration(conf_files=['C1.conf']) self.assertIn('autoexec', cfg.sections()) self.assertEqual(cfg['autoexec'], ['echo c1'])
def test_autoexec_single_bat(self): os.chdir('tests/files/no_conf') cfg = confgen.DosboxConfiguration(exe='file.bat') self.assertIn('autoexec', cfg.sections()) self.assertEqual(cfg['autoexec'], ['mount C .', 'C:', 'call file.bat'])
def test_autoexec_with_commands(self): os.chdir('tests/files/no_conf') cfg = confgen.DosboxConfiguration(commands=['foo', 'bar']) self.assertIn('autoexec', cfg.sections()) self.assertEqual(cfg['autoexec'], ['foo', 'bar'])
def test_autoexec_no_autoexec(self): os.chdir('tests/files/confs') cfg = confgen.DosboxConfiguration(conf_files=['no_autoexec.conf', 'empty_autoexec.conf']) self.assertEqual(cfg['autoexec'], [])
def test_autoexec_default_3(self): os.chdir('tests/files/case') cfg = confgen.DosboxConfiguration(commands=['foo']) self.assertEqual(cfg['autoexec'], ['echo dOsBoX', 'foo'])
def test_autoexec_default_2(self): os.chdir('tests/files/default') cfg = confgen.DosboxConfiguration(conf_files=['c.conf']) self.assertEqual(cfg['autoexec'], ['cmd'])
def test_autoexec_default_1(self): os.chdir('tests/files/default') cfg = confgen.DosboxConfiguration(commands=['cmd']) self.assertEqual(cfg['autoexec'], ['echo dosbox', 'cmd'])