Beispiel #1
0
 def setUp(self):
     rawapi.sane_init()
     devices = 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)
Beispiel #2
0
 def setUp(self):
     rawapi.sane_init()
     devices = 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)
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
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")
Beispiel #6
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")