def test_sdl2_for_fc30pro(self): controllers = dict() controllers['1'] = Controller("contr1", "joypad", "05000000103800000900000000010000", '1', "0", "szmy-power Ltd. Joypad ", dict()) driver = libretroControllers.getInputDriver(controllers) self.assertEquals("sdl2", driver)
def test_sdl2_for_nes30pro(self): controllers = dict() controllers['1'] = Controller("contr1", "joypad", "030000003512000012ab000010010000", '1', "0", "Bluetooth Wireless Controller ", dict()) driver = libretroControllers.getInputDriver(controllers) self.assertEquals("sdl2", driver)
def test_udev_by_default(self): controllers = dict() controllers['1'] = Controller("contr1", "joypad", "GUID1", '1', "0", "Joypad1RealName", dict()) driver = libretroControllers.getInputDriver(controllers) self.assertEquals("udev", driver)
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 retroarch configuration libretroControllers.coreSettings = UnixSettings(RETROARCH_CORE_CONFIG, separator=' ') # Test objects basicInputs1 = { 'a': controllersConfig.Input("a", "button", "10", "1"), 'hotkey': controllersConfig.Input("hotkey", "button", "10", "1"), 'start': controllersConfig.Input("start", "button", "11", "1") } basicController1 = Controller("contr1", "joypad", "GUID1", '1', "0", "Joypad1RealName", basicInputs1) PS3UUID = "060000004c0500006802000000010000" GPIOUUID = "15000000010000000100000000010000" snes = Emulator('snes', 'snes', 'libretro') class TestLibretroController(unittest.TestCase): def test_generate_simple_controller(self): config = libretroControllers.generateControllerConfig(basicController1) self.assertEquals(config['input_player1_a_btn'], '10') def test_generate_ps3_controller_buttons(self): controllers = controllersConfig.loadControllerConfig( 0, PS3UUID, "p1controller", "", -1, 0, "p2controller", "", -1, 0, "p3controller", "", -1, 0, "p4controller", "") config = libretroControllers.generateControllerConfig(controllers["1"])