Exemple #1
0
def step_impl(context, choice):
    driver = context.driver
    util = context.util

    if choice == "decreases":
        key = "["
    elif choice == "increases":
        key = "]"
    else:
        raise ValueError("unexpected choice: " + choice)

    initial_level = wedutil.get_label_visibility_level(util)
    context.caret_position_before_label_visibility_change = \
        wedutil.caret_screen_pos(driver)

    util.ctrl_equivalent_x(key)

    # We don't allow the increase or decrease to do nothing.
    if choice == "decreases":
        expected = initial_level - 1
    elif choice == "increases":
        expected = initial_level + 1
    else:
        raise ValueError("unexpected choice: " + choice)

    util.wait(lambda *_: wedutil.get_label_visibility_level(util) == expected)
Exemple #2
0
def step_impl(context, choice):
    driver = context.driver
    util = context.util

    initial_level = wedutil.get_label_visibility_level(util)
    context.caret_position_before_label_visibility_change = \
        wedutil.caret_screen_pos(driver)

    # We don't allow the increase or decrease to do nothing.
    if choice == "decreases":
        expected = initial_level - 1
    elif choice == "increases":
        expected = initial_level + 1
    else:
        raise ValueError("unexpected choice: " + choice)

    if not util.osx:
        util.ctrl_x({
            "decreases": "[",
            "increases": "]",
        }[choice])

    else:
        # On OSX, we have to use the toolbar.
        context.execute_steps(u"""\
When the user clicks the toolbar button "{}"
        """.format({
            "decreases": "Decrease label visibility level",
            "increases": "Increase label visibility level",
        }[choice]))

    util.wait(lambda *_: wedutil.get_label_visibility_level(util) == expected)
Exemple #3
0
def step_impl(context, level):
    driver = context.driver
    util = context.util

    level = int(level)
    assert_equal(wedutil.get_label_visibility_level(util), level)

    n_labels, n_displayed = get_labels_stats(driver)
    assert_true(n_labels)
    # Saving the labels themselves is pointless because redecoration
    # can destroy the elements that are now in the GUI.
    context.number_of_visible_labels = n_displayed