예제 #1
0
def test_editing_cusom_entry(monitor, dialog_sleep):
    """Test that we can edit an existing monitored entry.

    """
    e = MonitoredEntry(
        name='test',
        path='test',
        depend_on=['root/test', 'root/simp/test', 'root/comp/test'],
        formatting=('{root/test}, {root/simp/test}, '
                    '{root/comp/test}'))

    # Test cancelling after editon.
    d = EntryDialog(monitor=monitor, entry=e)
    d.show()
    process_app_events()
    sleep(dialog_sleep)

    w = d.central_widget().widgets()
    assert w[1].text == 'test'
    w[1].text = 'dummy'
    process_app_events()
    sleep(dialog_sleep)

    w[-1].clicked = True
    process_app_events()
    assert d.entry.name == 'test'

    # Test doing some actuel editions
    d = EntryDialog(monitor=monitor, entry=e)
    d.show()
    process_app_events()
    sleep(dialog_sleep)

    w = d.central_widget().widgets()
    w[1].text = 'test2'
    process_app_events()
    sleep(dialog_sleep)

    w[5].text = '{simp/test}, {comp/test}'
    process_app_events()
    sleep(dialog_sleep)

    b = d.builder
    assert b.used_entries[0].entry == 'root/test'
    b.remove_entry(0)
    process_app_events()
    sleep(dialog_sleep)

    w[-2].clicked = True
    process_app_events()

    e = d.entry
    assert e.name == 'test2'
    assert (sorted(e.depend_on) == sorted(
        ('root/simp/test', 'root/comp/test')))
예제 #2
0
def test_editing_cusom_entry(monitor, dialog_sleep):
    """Test that we can edit an existing monitored entry.

    """
    e = MonitoredEntry(name='test', path='test',
                       depend_on=['root/test', 'root/simp/test',
                                  'root/comp/test'],
                       formatting=('{root/test}, {root/simp/test}, '
                                   '{root/comp/test}')
                       )

    # Test cancelling after editon.
    d = EntryDialog(monitor=monitor, entry=e)
    d.show()
    process_app_events()
    sleep(dialog_sleep)

    w = d.central_widget().widgets()
    assert w[1].text == 'test'
    w[1].text = 'dummy'
    process_app_events()
    sleep(dialog_sleep)

    w[-1].clicked = True
    process_app_events()
    assert d.entry.name == 'test'

    # Test doing some actuel editions
    d = EntryDialog(monitor=monitor, entry=e)
    d.show()
    process_app_events()
    sleep(dialog_sleep)

    w = d.central_widget().widgets()
    w[1].text = 'test2'
    process_app_events()
    sleep(dialog_sleep)

    w[5].text = '{simp/test}, {comp/test}'
    process_app_events()
    sleep(dialog_sleep)

    b = d.builder
    assert b.used_entries[0].entry == 'root/test'
    b.remove_entry(0)
    process_app_events()
    sleep(dialog_sleep)

    w[-2].clicked = True
    process_app_events()

    e = d.entry
    assert e.name == 'test2'
    assert (sorted(e.depend_on) ==
            sorted(('root/simp/test', 'root/comp/test')))
예제 #3
0
def test_creating_new_custom_entry(monitor, dialog_sleep):
    """Test creating an  entry using the dialog.

    """
    d = EntryDialog(monitor=monitor)
    d.show()
    process_app_events()
    sleep(dialog_sleep)

    w = d.central_widget().widgets()
    w[1].text = 'test'
    process_app_events()
    sleep(dialog_sleep)

    w[5].text = '{root/test}, {simp/test}, {comp/test}'
    process_app_events()
    sleep(dialog_sleep)

    b = d.builder
    for e in ('root/test', 'simp/test', 'comp/test'):
        assert e in b.map_entries
    b.add_entry(0, 'after')
    assert b.used_entries
    process_app_events()
    sleep(dialog_sleep)

    b.used_entries[0].entry = 'root/test'
    process_app_events()
    sleep(dialog_sleep)

    b.add_entry(0, 'after')
    assert not b.used_entries[-1].entry
    process_app_events()
    sleep(dialog_sleep)

    b.used_entries[-1].entry = 'simp/test'
    process_app_events()
    sleep(dialog_sleep)

    b.add_entry(0, 'before')
    assert not b.used_entries[0].entry
    process_app_events()
    sleep(dialog_sleep)

    b.used_entries[0].entry = 'comp/test'
    process_app_events()
    sleep(dialog_sleep)

    w[-2].clicked = True
    process_app_events()

    assert d.entry
    e = d.entry
    assert e.name == 'test'
    assert (sorted(e.depend_on) == sorted(
        ('root/test', 'root/simp/test', 'root/comp/test')))

    d.close()
    process_app_events()
예제 #4
0
def test_creating_new_custom_entry(monitor, dialog_sleep):
    """Test creating an  entry using the dialog.

    """
    d = EntryDialog(monitor=monitor)
    d.show()
    process_app_events()
    sleep(dialog_sleep)

    w = d.central_widget().widgets()
    w[1].text = 'test'
    process_app_events()
    sleep(dialog_sleep)

    w[5].text = '{root/test}, {simp/test}, {comp/test}'
    process_app_events()
    sleep(dialog_sleep)

    b = d.builder
    for e in ('root/test', 'simp/test', 'comp/test'):
        assert e in b.map_entries
    b.add_entry(0, 'after')
    assert b.used_entries
    process_app_events()
    sleep(dialog_sleep)

    b.used_entries[0].entry = 'root/test'
    process_app_events()
    sleep(dialog_sleep)

    b.add_entry(0, 'after')
    assert not b.used_entries[-1].entry
    process_app_events()
    sleep(dialog_sleep)

    b.used_entries[-1].entry = 'simp/test'
    process_app_events()
    sleep(dialog_sleep)

    b.add_entry(0, 'before')
    assert not b.used_entries[0].entry
    process_app_events()
    sleep(dialog_sleep)

    b.used_entries[0].entry = 'comp/test'
    process_app_events()
    sleep(dialog_sleep)

    w[-2].clicked = True
    process_app_events()

    assert d.entry
    e = d.entry
    assert e.name == 'test'
    assert (sorted(e.depend_on) ==
            sorted(('root/test', 'root/simp/test', 'root/comp/test')))

    d.close()
    process_app_events()