Exemplo n.º 1
0
def test_option_changes(sensor):
    options = sensor.get_supported_options()
    for option in options:
        try:
            if sensor.is_option_read_only(option):
                continue
            old_value = sensor.get_option(option)
            range = sensor.get_option_range(option)
            new_value = range.min
            if old_value == new_value:
                new_value = range.max
            if not log.d(str(option), old_value, '->', new_value):
                test.info(str(option), new_value, persistent=True)
            set_new_value(sensor, option, new_value)
            sensor.set_option(option, old_value)
        except:
            test.unexpected_exception()
            break
        finally:
            test.reset_info(persistent=True)
Exemplo n.º 2
0
        if depth_sensor.is_option_read_only(option):
            continue
        old_value = depth_sensor.get_option(option)
        range = depth_sensor.get_option_range(option)
        new_value = range.min
        if old_value == new_value:
            new_value = range.max
        if not log.d(str(option), old_value, '->', new_value):
            test.info(str(option), new_value, persistent=True)
        set_new_value(depth_sensor, option, new_value)
        depth_sensor.set_option(option, old_value)
    except:
        test.unexpected_exception()
        test.abort()
    finally:
        test.reset_info(persistent=True)

for option in color_options:
    try:
        if color_sensor.is_option_read_only(option):
            continue
        new_value = color_sensor.get_option_range(option).min
        set_new_value(color_sensor, option, new_value)
    except:
        option_name = "Color sensor - " + str(option)
        test.info(option_name, new_value)
        test.unexpected_exception()
        test.abort()

test.finish()