コード例 #1
0
ファイル: listbasetest.cpp プロジェクト: 781155640/wxWidgets
void ListBaseTestCase::EditLabel()
{
#if wxUSE_UIACTIONSIMULATOR
    wxListCtrl* const list = GetList();

    list->SetWindowStyleFlag(wxLC_REPORT | wxLC_EDIT_LABELS);

    list->InsertColumn(0, "Column 0");

    list->InsertItem(0, "Item 0");
    list->InsertItem(1, "Item 1");

    EventCounter beginedit(list, wxEVT_LIST_BEGIN_LABEL_EDIT);
    EventCounter endedit(list, wxEVT_LIST_END_LABEL_EDIT);

    wxUIActionSimulator sim;

    list->EditLabel(0);

    sim.Text("sometext");
    sim.Char(WXK_RETURN);

    wxYield();

    CPPUNIT_ASSERT_EQUAL(1, beginedit.GetCount());
    CPPUNIT_ASSERT_EQUAL(1, endedit.GetCount());
#endif
}
コード例 #2
0
void TreeCtrlTestCase::LabelEdit()
{
    EventCounter beginedit(m_tree, wxEVT_TREE_BEGIN_LABEL_EDIT);
    EventCounter endedit(m_tree, wxEVT_TREE_END_LABEL_EDIT);

    wxUIActionSimulator sim;

    m_tree->SetFocusedItem(m_tree->GetRootItem());
    m_tree->EditLabel(m_tree->GetRootItem());

    sim.Text("newroottext");
    wxYield();

    CPPUNIT_ASSERT_EQUAL(1, beginedit.GetCount());

    sim.Char(WXK_RETURN);
    wxYield();

    CPPUNIT_ASSERT_EQUAL(1, endedit.GetCount());
}