def setUp(self): # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../resources/es_input.cfg.origin")), \ os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg"))) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/fba2x.cfg.origin')), \ fba2xCustom) # Injecting test file self.fbaSettings = unixSettings.UnixSettings(fba2xCustom) fba2xControllers.fbaSettings = self.fbaSettings
shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../resources/retroarchcustom.cfg.origin")), \ os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/retroarchcustom.cfg"))) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../resources/es_input.cfg.origin")), \ os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg"))) # Injecting test recalbox.conf libretroControllers.settingsRoot = os.path.abspath( os.path.join(os.path.dirname(__file__), "tmp")) # Injecting test es_input controllersConfig.esInputs = os.path.abspath( os.path.join(os.path.dirname(__file__), "tmp/es_input.cfg")) # Injecting test retroarch.conf libretroSettingsFile = os.path.abspath( os.path.join(os.path.dirname(__file__), "tmp/retroarchcustom.cfg")) libretroSettings = unixSettings.UnixSettings(libretroSettingsFile, ' ') libretroControllers.libretroSettings = libretroSettings # Test objects basicInputs1 = { 'a': controllersConfig.Input("a", "button", "10", "1"), 'start': controllersConfig.Input("start", "button", "11", "1") } basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1", '1', 0, "Joypad1RealName", basicInputs1) basicController2 = controllersConfig.Controller("contr2", "joypad", "GUID2", '2', 1, "Joypad2RealName", basicInputs1) basicController3 = controllersConfig.Controller("contr3", "joypad", "GUID3", '3', 2, "Joypad3RealName",
emulator='fba2x', configfile='lol') # test inputs basicInputs1 = { 'hotkey': controllersConfig.Input("hotkey", "button", "10", "1", "0") } basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1", "0", "Joypad1RealName", basicInputs1) rom = "MyRom.zip" # Injecting test files fba2xGenerator.rhgamestationFiles.fbaCustom = FBA2X_CUSTOM_CFG_FILE fba2xGenerator.rhgamestationFiles.fbaCustomOrigin = FBA2X_ORIGIN_CFG_FILE fba2xGenerator.fba2xConfig.fbaSettings = unixSettings.UnixSettings( FBA2X_CUSTOM_CFG_FILE) fba2xGenerator.fba2xControllers.fbaSettings = unixSettings.UnixSettings( FBA2X_CUSTOM_CFG_FILE) fba2xGen = Fba2xGenerator() class TestLibretroGenerator(unittest.TestCase): def test_generate_system_no_custom_settings(self): command = fba2xGen.generate(fbaSystem, rom, dict()) self.assertEquals(command.videomode, '4') self.assertEquals(command.array, [ '/usr/bin/fba2x', '--configfile', FBA2X_CUSTOM_CFG_FILE, '--logfile', '/rhgamestation/share/system/logs//fba2x.log', 'MyRom.zip' ])
os.path.join(os.path.dirname(__file__), "tmp/retroarchcorecustom.cfg")) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/retroarchcustom.cfg.origin')), \ RETROARCH_CUSTOM_CFG_FILE) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/retroarchcustom.cfg.origin')), \ RETROARCH_ORIGIN_CFG_FILE) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/rhgamestation.conf.origin')), \ RHGAMESTATION_CFG_FILE) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../../resources/retroarchcores.cfg")), \ RETROARCH_CORE_CONFIG) # Injecting test files libretroGenerator.rhgamestationFiles.retroarchCustom = RETROARCH_CUSTOM_CFG_FILE libretroGenerator.rhgamestationFiles.retroarchCustomOrigin = RETROARCH_ORIGIN_CFG_FILE libretroConfig.coreSettings = unixSettings.UnixSettings(RETROARCH_CORE_CONFIG, separator=' ') libretroConfig.libretroSettings = unixSettings.UnixSettings( RETROARCH_CUSTOM_CFG_FILE, separator=' ') PS3UUID = "060000004c0500006802000000010000" rom = "MyRom.nes" libretroGen = LibretroGenerator() class TestLibretroGenerator(unittest.TestCase): def setUp(self): self.snes = Emulator(name='snes', videomode='4',
RECALBOX_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/recalbox.conf')) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/retroarchcustom.cfg.origin')), \ RETROARCH_CUSTOM_CFG_FILE) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/retroarchcustom.cfg.origin')), \ RETROARCH_ORIGIN_CFG_FILE) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/recalbox.conf.origin')), \ RECALBOX_CFG_FILE) # Injecting test files libretroGenerator.recalboxFiles.retroarchCustom = RETROARCH_CUSTOM_CFG_FILE libretroGenerator.recalboxFiles.retroarchCustomOrigin = RETROARCH_ORIGIN_CFG_FILE libretroConfig.libretroSettings = unixSettings.UnixSettings( RETROARCH_CUSTOM_CFG_FILE, separator=' ') PS3UUID = "060000004c0500006802000000010000" rom = "MyRom.nes" libretroGen = LibretroGenerator() class TestLibretroGenerator(unittest.TestCase): def setUp(self): self.snes = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='auto',
import configgen.generators.libretro.libretroConfig as libretroConfig import configgen.settings.unixSettings as unixSettings import configgen.settings.recalboxSettings as recalSettings retroarchcustomFile = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/retroarchcustom.cfg')) recalboxConfFile = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/recalbox.conf')) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/retroarchcustom.cfg.origin')), \ retroarchcustomFile) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/recalbox.conf.origin')), \ recalboxConfFile) libretroSettings = unixSettings.UnixSettings(retroarchcustomFile, ' ') # test Systems snes = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='auto', smooth='2', rewind='false', emulator='libretro') nes = Emulator(name='nes', videomode='4', core='pocketsnes', shaders='', ratio='16/9',
FBA2X_ORIGIN_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/fba2x.cfg.origin')) FBA2X_CUSTOM_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/fba2x.cfg')) RECALBOX_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/recalbox.conf')) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/fba2x.cfg.origin')), \ FBA2X_ORIGIN_CFG_FILE) # Injecting test files fba2xGenerator.recalboxFiles.fbaCustom = FBA2X_CUSTOM_CFG_FILE fba2xGenerator.recalboxFiles.fbaCustomOrigin = FBA2X_ORIGIN_CFG_FILE fba2xConfig.fbaSettings = unixSettings.UnixSettings(FBA2X_CUSTOM_CFG_FILE) # test Systems fbaSystem = Emulator(name='fba', videomode='4', shaders='', ratio='auto', smooth='2', emulator='pifba') fbaSystemCustom = Emulator(name='fba', videomode='6', shaders='', ratio='auto', smooth='2', emulator='pifba',
import configgen.generators.mupen.mupenControllers as mupenControllers MUPEN_CUSTOM_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/mupen64plus.cfg')) RHGAMESTATION_CFG_FILE = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/rhgamestation.conf')) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/mupen64plus.cfg')), \ MUPEN_CUSTOM_CFG_FILE) # Injecting test files mupenControllers.rhgamestationFiles.mupenCustom = MUPEN_CUSTOM_CFG_FILE mupenControllers.mupenSettings = unixSettings.UnixSettings( MUPEN_CUSTOM_CFG_FILE, separator=' ') # test Systems n64 = Emulator(name='n64', videomode='4', core='n64', shaders='', ratio='auto', smooth='2', rewind='false', emulator='mupen64plus') # test inputs basicInputs1 = { 'hotkey': controllersConfig.Input("hotkey", "button", "10", "1") }
from configgen.Emulator import Emulator sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..'))) import configgen.generators.fba2x.fba2xConfig as fba2xConfig import configgen.settings.unixSettings as unixSettings fba2xCustom = os.path.abspath( os.path.join(os.path.dirname(__file__), 'tmp/fba2x.cfg')) # Cloning config files shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), '../../resources/fba2x.cfg.origin')), \ fba2xCustom) fbaSettings = unixSettings.UnixSettings(fba2xCustom) # test Systems fba2xNormal = Emulator(name='fba', videomode='4', ratio='auto', smooth='1', emulator='fba2x') fba2x43 = Emulator(name='fba', videomode='4', ratio='4/3', smooth='0', shaders='scanlines', emulator='fba2x') fba2x169 = Emulator(name='fba', videomode='4', ratio='16/9', emulator='fba2x')
import shutil sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import configgen.settings.unixSettings as unixSet shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../resources/unixSettings.cfg")), \ os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/unixSettings.cfg"))) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../resources/retroarchcustom.cfg.origin")), \ os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/retroarchcustom.cfg"))) # Injecting test unixSettings noSeparatorFile = os.path.abspath( os.path.join(os.path.dirname(__file__), "tmp/unixSettings.cfg")) spaceSeparatorFile = os.path.abspath( os.path.join(os.path.dirname(__file__), "tmp/retroarchcustom.cfg")) unixSettings = unixSet.UnixSettings(noSeparatorFile) rhgamestationSettings = unixSet.UnixSettings(spaceSeparatorFile, ' ') class TestUnixSettings(unittest.TestCase): def test_load_empty_value_should_return_none(self): name = "I dont exists" loaded = unixSettings.load(name) self.assertEquals(None, loaded) def test_load_disabled_value_return_none(self): name = "aspect_ratio_index" loaded = unixSettings.load(name) self.assertEquals(None, loaded) def test_load_enabled_value_without_quotes(self):
import shutil sys.path.append( os.path.abspath(os.path.join(os.path.dirname(__file__), "../../"))) import configgen.settings.unixSettings as unixSet shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../resources/unixSettings.cfg")), \ os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/unixSettings.cfg"))) shutil.copyfile(os.path.abspath(os.path.join(os.path.dirname(__file__), "../resources/retroarchcustom.cfg.origin")), \ os.path.abspath(os.path.join(os.path.dirname(__file__), "tmp/retroarchcustom.cfg"))) # Injecting test unixSettings noSeparatorFile = os.path.abspath( os.path.join(os.path.dirname(__file__), "tmp/unixSettings.cfg")) spaceSeparatorFile = os.path.abspath( os.path.join(os.path.dirname(__file__), "tmp/retroarchcustom.cfg")) unixSettings = unixSet.UnixSettings(noSeparatorFile) recalboxSettings = unixSet.UnixSettings(spaceSeparatorFile, ' ') class TestUnixSettings(unittest.TestCase): def test_load_empty_value_should_return_none(self): name = "I dont exists" loaded = unixSettings.load(name) self.assertEquals(None, loaded) def test_load_disabled_value_return_none(self): name = "aspect_ratio_index" loaded = unixSettings.load(name) self.assertEquals(None, loaded) def test_load_enabled_value_without_quotes(self): name = "config_save_on_exit"