Beispiel #1
0
void BookCtrlBaseTestCase::ChangeEvents()
{
    wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
                                          wxTestableFrame);

    wxBookCtrlBase * const base = GetBase();

    base->SetSelection(0);

    EventCounter count(base, GetChangingEvent());
    EventCounter count1(base, GetChangedEvent());

    base->SetSelection(1);

    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));

    base->ChangeSelection(2);

    CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(GetChangingEvent()));
    CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(GetChangedEvent()));

    base->AdvanceSelection();

    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));

    base->AdvanceSelection(false);

    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));
}
void BookCtrlBaseTestCase::ChangeEvents()
{
    wxBookCtrlBase * const base = GetBase();

    base->SetSelection(0);

    EventCounter changing(base, GetChangingEvent());
    EventCounter changed(base, GetChangedEvent());

    base->SetSelection(1);

    CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
    CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());

    changed.Clear();
    changing.Clear();
    base->ChangeSelection(2);

    CPPUNIT_ASSERT_EQUAL(0, changing.GetCount());
    CPPUNIT_ASSERT_EQUAL(0, changed.GetCount());

    base->AdvanceSelection();

    CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
    CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());

    changed.Clear();
    changing.Clear();
    base->AdvanceSelection(false);

    CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
    CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
}