Exemplo n.º 1
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)
Exemplo n.º 2
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)
Exemplo n.º 3
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")
Exemplo n.º 4
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")
Exemplo n.º 5
0
 def test_get_option_descriptor_0(self):
     opt_desc = rawapi.sane_get_option_descriptor(self.dev_handle, 0)
     # XXX(Jflesch): The name may vary: sometimes it's empty, sometimes it's
     # "option-cnt"
     # self.assertEqual(opt_desc.name, "")
     self.assertEqual(opt_desc.title, b"Number of options")
     self.assertEqual(opt_desc.type, rawapi.SaneValueType.INT)
     self.assertEqual(opt_desc.unit, rawapi.SaneUnit.NONE)
     self.assertEqual(opt_desc.size, 4)
     self.assertEqual(opt_desc.cap, rawapi.SaneCapabilities.SOFT_DETECT)
     self.assertEqual(opt_desc.constraint_type,
                      rawapi.SaneConstraintType.NONE)
Exemplo n.º 6
0
 def test_get_option_descriptor_0(self):
     opt_desc = rawapi.sane_get_option_descriptor(self.dev_handle, 0)
     # XXX(Jflesch): The name may vary: sometimes it's empty, sometimes it's
     # "option-cnt"
     # self.assertEqual(opt_desc.name, "")
     self.assertEqual(opt_desc.title, b"Number of options")
     self.assertEqual(opt_desc.type, rawapi.SaneValueType.INT)
     self.assertEqual(opt_desc.unit, rawapi.SaneUnit.NONE)
     self.assertEqual(opt_desc.size, 4)
     self.assertEqual(opt_desc.cap, rawapi.SaneCapabilities.SOFT_DETECT)
     self.assertEqual(opt_desc.constraint_type,
                      rawapi.SaneConstraintType.NONE)