def test_get_option_value(self): for opt_idx in range(0, self.nb_options): desc = rawapi.sane_get_option_descriptor(self.dev_handle, opt_idx) if not rawapi.SaneValueType(desc.type).can_getset_opt(): continue val = rawapi.sane_get_option_value(self.dev_handle, opt_idx) self.assertNotEqual(val, None)
def setUp(self): rawapi.sane_init() devices = get_test_devices() self.assertTrue(len(devices) > 0) dev_name = devices[0].name self.dev_handle = rawapi.sane_open(dev_name) self.nb_options = rawapi.sane_get_option_value(self.dev_handle, 0)
def setUp(self): rawapi.sane_init() devices = rawapi.sane_get_devices() self.assertTrue(len(devices) > 0) dev_name = devices[0].name self.dev_handle = rawapi.sane_open(dev_name) self.nb_options = rawapi.sane_get_option_value(self.dev_handle, 0)
def test_set_option_value(self): for opt_idx in range(0, self.nb_options): desc = rawapi.sane_get_option_descriptor(self.dev_handle, opt_idx) if desc.name != "mode" or not rawapi.SaneValueType(desc.type).can_getset_opt(): continue info = rawapi.sane_set_option_value(self.dev_handle, opt_idx, "Gray") self.assertFalse(rawapi.SaneInfo.INEXACT in info) val = rawapi.sane_get_option_value(self.dev_handle, opt_idx) self.assertEqual(val, "Gray")
def test_get_option_value(self): for opt_idx in range(0, self.nb_options): desc = rawapi.sane_get_option_descriptor(self.dev_handle, opt_idx) if not rawapi.SaneValueType(desc.type).can_getset_opt(): continue if desc.cap | rawapi.SaneCapabilities.INACTIVE == desc.cap: continue val = rawapi.sane_get_option_value(self.dev_handle, opt_idx) self.assertNotEqual(val, None)
def test_set_option_value(self): for opt_idx in range(0, self.nb_options): desc = rawapi.sane_get_option_descriptor(self.dev_handle, opt_idx) if (desc.name != "mode" or not rawapi.SaneValueType(desc.type).can_getset_opt()): continue info = rawapi.sane_set_option_value(self.dev_handle, opt_idx, "Gray") self.assertFalse(rawapi.SaneInfo.INEXACT in info) val = rawapi.sane_get_option_value(self.dev_handle, opt_idx) self.assertEqual(val, "Gray")
def __load_options(self): if self.__options != None: return self._open() nb_options = rawapi.sane_get_option_value(sane_dev_handle[1], 0) self.__options = {} for opt_idx in range(1, nb_options): opt_desc = rawapi.sane_get_option_descriptor(sane_dev_handle[1], opt_idx) if not rawapi.SaneValueType(opt_desc.type).can_getset_opt(): continue opt = ScannerOption.build_from_rawapi(self, opt_idx, opt_desc) self.__options[opt.name] = opt
def _get_value(self): self.__scanner._open() return rawapi.sane_get_option_value(sane_dev_handle[1], self.idx)