Example #1
0
    def setUpClass(self):
        # Wait for the daemon
        print("Waiting for daemon to be ready...")
        devman = openrazer.client.DeviceManager()
        devices = devman.devices
        print("\nDaemon ready. The test will now begin.\n")

        if len(devices) == 0:
            print("\nCannot start test as there are no devices!\n")
            exit(1)

        # No longer needed, as middleman's functions will be used.
        del (devman)

        # Common Polychromatic code
        def _dummy_i18n(string):
            return string

        self.dbg = common.Debugging()
        pref.init(_dummy_i18n)

        self.middleman = middleman.Middleman(self.dbg, common, _dummy_i18n)
        self.middleman.init()

        # Definitely do not download device images
        self.middleman.get_backend("openrazer").allow_image_download = False
Example #2
0
 def test_locales_can_translate_colours(self):
     _ = locales.Locales("polychromatic", "de_DE").init()
     if os.path.exists(self.paths.colours):
         os.remove(self.paths.colours)
     preferences.init(_)
     colours = preferences.load_file(self.paths.colours)
     passed = False
     for item in colours:
         # EN: Green | DE: Grün
         if item["name"] == "Grün":
             passed = True
     self.assertTrue(passed, "Could not translate colour strings")
Example #3
0
    def setUpClass(self):
        self.i18n = locales.Locales("polychromatic")
        self._ = self.i18n.init()
        self.dbg = common.Debugging()
        self.paths = common.paths
        preferences.init(self._)

        self.fileman = effects.EffectFileManagement(self.i18n, self._, self.dbg)

        # Dummy content
        self.fileman.save_item(self.fileman.init_data("Test 1", effects.TYPE_LAYERED))
        self.fileman.save_item(self.fileman.init_data("Test 2", effects.TYPE_LAYERED))
        self.fileman.save_item(self.fileman.init_data("Test 3", effects.TYPE_LAYERED))
Example #4
0
    def setUpClass(self):
        self.i18n = locales.Locales("polychromatic")
        self._ = self.i18n.init()
        self.dbg = common.Debugging()
        self.paths = common.paths
        preferences.init(self._)

        self.fileman = effects.EffectFileManagement(self.i18n, self._,
                                                    self.dbg)

        # Dummy content
        self.fileman.save_item(
            self.fileman.init_data("Test 1", effects.TYPE_LAYERED))
        self.fileman.save_item(
            self.fileman.init_data("Test 2", effects.TYPE_LAYERED))
        self.fileman.save_item(
            self.fileman.init_data("Test 3", effects.TYPE_LAYERED))

        # Unit test resources
        self.res_path = os.path.join(os.path.dirname(__file__), "files")
Example #5
0
 def setUp(self):
     self._ = locales.Locales("polychromatic").init()
     self.dbg = common.Debugging()
     self.paths = common.paths
     preferences.init(self._)