def test_padtype_psx(self): basicController = controllersConfig.Controller("contr1", "joypad", "GUID1", "0", "Joypad1RealName", axisAndBtnsInputs) padtype = libretroControllers.getAnalogMode(basicController, psx) self.assertEqual("0", padtype)
def test_padtype_only_hats(self): basicController = controllersConfig.Controller("contr1", "joypad", "GUID1", "0", "Joypad1RealName", onlyHatsInputs) padtype = libretroControllers.getAnalogMode(basicController, snes) self.assertEqual("1", padtype)
def setUp(self): self.snes = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='auto', smooth='2', rewind='false', emulator='libretro') self.snes2 = Emulator(name='snes', videomode='4', core='pocketsnes', shaders='', ratio='auto', smooth='2', rewind='false', emulator='libretro') self.nes = Emulator(name='nes', videomode='6', core='catsfc', shaders='', ratio='16/9', smooth='1', rewind='false', configfile='/myconfigfile.cfg', emulator='libretro') # test inputs self.basicInputs1 = {'hotkey': controllersConfig.Input("hotkey", "button", "10", "1")} self.basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1", 1, 0, "Joypad1RealName", self.basicInputs1) self.sdl2controler = controllersConfig.Controller("contr1", "joypad", "030000003512000012ab000010010000", 2, 1, "Bluetooth Wireless Controller ", self.basicInputs1) self.controllers = dict() self.controllers['1'] = self.basicController1 self.sdl2controllers = dict() self.sdl2controllers['1'] = self.basicController1 self.sdl2controllers['2'] = self.sdl2controler
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")} basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1", "0", "Joypad1RealName", basicInputs1) basicController2 = controllersConfig.Controller("contr2", "joypad", "GUID2", "1", "Joypad2RealName", basicInputs1) basicController3 = controllersConfig.Controller("contr3", "joypad", "GUID3", "2", "Joypad3RealName", basicInputs1) basicController4 = controllersConfig.Controller("contr4", "joypad", "GUID4", "3", "Joypad4RealName", basicInputs1) controllers4 = { "1": basicController1, "2": basicController2, "3": basicController3, "4": basicController4
smooth='2', emulator='pifba') fbaSystemCustom = Emulator(name='fba', videomode='6', shaders='', ratio='auto', smooth='2', emulator='pifba', configfile='lol') # test inputs basicInputs1 = { 'hotkey': controllersConfig.Input("hotkey", "button", "10", "1") } basicController1 = controllersConfig.Controller("contr1", "joypad", "GUID1", "0", "Joypad1RealName", basicInputs1) rom = "MyRom.zip" fba2xGen = Fba2xGenerator() fba2xGenerator.fba2xConfig.fbaSettings = fba2xConfig.fbaSettings 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, 'MyRom.zip'
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", basicInputs1) basicController4 = controllersConfig.Controller("contr4", "joypad", "GUID4", '4', 3, "Joypad4RealName", basicInputs1) controllers4 = { "1": basicController1, "2": basicController2, "3": basicController3, "4": basicController4