Ejemplo n.º 1
0
def test_initial_component():
    # BUG: the initial size of an Item with ComponentEditor is zero
    # in the Qt backend

    dialog = _ComponentDialog()
    ui = dialog.edit_traits()

    size = get_dialog_size(ui.control)
    nose.tools.assert_greater(size[0], 0)
    nose.tools.assert_greater(size[1], 0)
Ejemplo n.º 2
0
def test_initial_component():
    # BUG: the initial size of an Item with ComponentEditor is zero
    # in the Qt backend

    dialog = _ComponentDialog()
    ui = dialog.edit_traits()

    size = get_dialog_size(ui.control)
    nose.tools.assert_greater(size[0], 0)
    nose.tools.assert_greater(size[1], 0)
Ejemplo n.º 3
0
def test_initial_component_with_item_size():
    # BEH: the initial component size should respect the size of the

    dialog = _ComponentDialogWithSize()
    ui = dialog.edit_traits()

    size = get_dialog_size(ui.control)

    # leave a few pixel of margin for wx
    nose.tools.assert_greater(size[0], ITEM_WIDTH-1)
    nose.tools.assert_less(size[0], ITEM_WIDTH+30)

    nose.tools.assert_greater(size[1], ITEM_HEIGHT-1)
    nose.tools.assert_less(size[1], ITEM_HEIGHT+30)
Ejemplo n.º 4
0
def test_initial_component_with_item_size():
    # BEH: the initial component size should respect the size of the

    dialog = _ComponentDialogWithSize()
    ui = dialog.edit_traits()

    size = get_dialog_size(ui.control)

    # leave a few pixel of margin for wx
    nose.tools.assert_greater(size[0], ITEM_WIDTH - 1)
    nose.tools.assert_less(size[0], ITEM_WIDTH + 30)

    nose.tools.assert_greater(size[1], ITEM_HEIGHT - 1)
    nose.tools.assert_less(size[1], ITEM_HEIGHT + 30)
Ejemplo n.º 5
0
    def test_visible_when_layout(self):
        # Bug: The size of a dialog that contains elements that are activated
        # by "visible_when" can end up being the *sum* of the sizes of the
        # elements, even though the elements are mutually exclusive (e.g.,
        # a typical case is a dropbox that lets you select different cases).
        # The expected behavior is that the size of the dialog should be at
        # most the size of the largest combination of elements.

        dialog = VisibleWhenProblem()
        with reraise_exceptions(), create_ui(dialog) as ui:

            # have the dialog switch from group one to two and back to one
            dialog.which = "two"
            dialog.which = "one"

            # the size of the window should not be larger than the largest
            # combination (in this case, the `text_group` plus the `which` item
            size = get_dialog_size(ui.control)
            # leave some margin for labels, dropbox, etc
            self.assertLess(size[0], _TEXT_WIDTH + 100)
            self.assertLess(size[1], _TEXT_HEIGHT + 150)