DESTDIR =
WX_RELEASE = 2.9
-WX_VERSION = $(WX_RELEASE).2
+WX_VERSION = $(WX_RELEASE).3
LIBDIRNAME = $(wx_top_builddir)/lib
TEST_CXXFLAGS = $(__test_PCH_INC) -D__WX$(TOOLKIT)__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
test_gui_choicebooktest.o \
test_gui_choicetest.o \
test_gui_comboboxtest.o \
+ test_gui_dataviewctrltest.o \
test_gui_datepickerctrltest.o \
test_gui_frametest.o \
test_gui_gaugetest.o \
test_gui_comboboxtest.o: $(srcdir)/controls/comboboxtest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/comboboxtest.cpp
+test_gui_dataviewctrltest.o: $(srcdir)/controls/dataviewctrltest.cpp $(TEST_GUI_ODEP)
+ $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/dataviewctrltest.cpp
+
test_gui_datepickerctrltest.o: $(srcdir)/controls/datepickerctrltest.cpp $(TEST_GUI_ODEP)
$(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/datepickerctrltest.cpp
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: tests/controls/treectrltest.cpp
+// Purpose: wxDataViewCtrl unit test
+// Author: Vaclav Slavik
+// Created: 2011-08-08
+// RCS-ID: $Id$
+// Copyright: (c) 2011 Vaclav Slavik <vslavik@gmail.com>
+///////////////////////////////////////////////////////////////////////////////
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#include "testprec.h"
+
+#if wxUSE_DATAVIEWCTRL
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#include "wx/app.h"
+#include "wx/dataview.h"
+
+#include "testableframe.h"
+
+// ----------------------------------------------------------------------------
+// test class
+// ----------------------------------------------------------------------------
+
+class DataViewCtrlTestCase : public CppUnit::TestCase
+{
+public:
+ DataViewCtrlTestCase() { }
+
+ virtual void setUp();
+ virtual void tearDown();
+
+private:
+ CPPUNIT_TEST_SUITE( DataViewCtrlTestCase );
+ CPPUNIT_TEST( DeleteSelected );
+ CPPUNIT_TEST( DeleteNotSelected );
+ CPPUNIT_TEST_SUITE_END();
+
+ void DeleteSelected();
+ void DeleteNotSelected();
+
+ // the dataview control itself
+ wxDataViewTreeCtrl *m_dvc;
+
+ // and some of its items
+ wxDataViewItem m_root,
+ m_child1,
+ m_child2,
+ m_grandchild;
+
+ DECLARE_NO_COPY_CLASS(DataViewCtrlTestCase)
+};
+
+// register in the unnamed registry so that these tests are run by default
+CPPUNIT_TEST_SUITE_REGISTRATION( DataViewCtrlTestCase );
+
+// also include in its own registry so that these tests can be run alone
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( DataViewCtrlTestCase, "DataViewCtrlTestCase" );
+
+// ----------------------------------------------------------------------------
+// test initialization
+// ----------------------------------------------------------------------------
+
+void DataViewCtrlTestCase::setUp()
+{
+ m_dvc = new wxDataViewTreeCtrl(wxTheApp->GetTopWindow(),
+ wxID_ANY,
+ wxDefaultPosition,
+ wxSize(400, 200),
+ wxDV_MULTIPLE);
+
+ m_root = m_dvc->AppendContainer(wxDataViewItem(), "The root");
+ m_child1 = m_dvc->AppendContainer(m_root, "child1");
+ m_grandchild = m_dvc->AppendItem(m_child1, "grandchild");
+ m_child2 = m_dvc->AppendItem(m_root, "child2");
+
+ m_dvc->SetSize(400, 200);
+ m_dvc->ExpandAncestors(m_root);
+ m_dvc->Refresh();
+ m_dvc->Update();
+}
+
+void DataViewCtrlTestCase::tearDown()
+{
+ delete m_dvc;
+ m_dvc = NULL;
+
+ m_root =
+ m_child1 =
+ m_child2 =
+ m_grandchild = wxDataViewItem();
+}
+
+// ----------------------------------------------------------------------------
+// the tests themselves
+// ----------------------------------------------------------------------------
+
+void DataViewCtrlTestCase::DeleteSelected()
+{
+ wxDataViewItemArray sel;
+ sel.push_back(m_child1);
+ sel.push_back(m_grandchild);
+ sel.push_back(m_child2);
+ m_dvc->SetSelections(sel);
+
+ // delete a selected item
+ m_dvc->DeleteItem(m_child1);
+
+ m_dvc->GetSelections(sel);
+
+ // m_child1 and its children should be removed from the selection now
+ CPPUNIT_ASSERT( sel.size() == 1 );
+ CPPUNIT_ASSERT( sel[0] == m_child2 );
+}
+
+void DataViewCtrlTestCase::DeleteNotSelected()
+{
+ wxDataViewItemArray sel;
+ sel.push_back(m_child1);
+ sel.push_back(m_grandchild);
+ m_dvc->SetSelections(sel);
+
+ // delete unselected item
+ m_dvc->DeleteItem(m_child2);
+
+ m_dvc->GetSelections(sel);
+
+ // m_child1 and its children should be removed from the selection now
+ CPPUNIT_ASSERT( sel.size() == 2 );
+ CPPUNIT_ASSERT( sel[0] == m_child1 );
+ CPPUNIT_ASSERT( sel[1] == m_grandchild );
+}
+
+#endif //wxUSE_TREECTRL
$(OBJS)\test_gui_choicebooktest.obj \\r
$(OBJS)\test_gui_choicetest.obj \\r
$(OBJS)\test_gui_comboboxtest.obj \\r
- $(OBJS)\test_gui_datepickerctrltest.obj \
+ $(OBJS)\test_gui_dataviewctrltest.obj \\r
+ $(OBJS)\test_gui_datepickerctrltest.obj \\r
$(OBJS)\test_gui_frametest.obj \\r
$(OBJS)\test_gui_gaugetest.obj \\r
$(OBJS)\test_gui_gridtest.obj \\r
$(OBJS)\test_gui_comboboxtest.obj: .\controls\comboboxtest.cpp\r
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\comboboxtest.cpp\r
\r
-$(OBJS)\test_gui_datepickerctrltest.obj: .\controls\datepickerctrltest.cpp
- $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\datepickerctrltest.cpp
-
+$(OBJS)\test_gui_dataviewctrltest.obj: .\controls\dataviewctrltest.cpp\r
+ $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\dataviewctrltest.cpp\r
+\r
+$(OBJS)\test_gui_datepickerctrltest.obj: .\controls\datepickerctrltest.cpp\r
+ $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\datepickerctrltest.cpp\r
+\r
$(OBJS)\test_gui_frametest.obj: .\controls\frametest.cpp\r
$(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\frametest.cpp\r
\r
$(OBJS)\test_gui_choicebooktest.o \\r
$(OBJS)\test_gui_choicetest.o \\r
$(OBJS)\test_gui_comboboxtest.o \\r
- $(OBJS)\test_gui_datepickerctrltest.o \
+ $(OBJS)\test_gui_dataviewctrltest.o \\r
+ $(OBJS)\test_gui_datepickerctrltest.o \\r
$(OBJS)\test_gui_frametest.o \\r
$(OBJS)\test_gui_gaugetest.o \\r
$(OBJS)\test_gui_gridtest.o \\r
$(OBJS)\test_gui_comboboxtest.o: ./controls/comboboxtest.cpp\r
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
\r
-$(OBJS)\test_gui_datepickerctrltest.o: ./controls/datepickerctrltest.cpp
- $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<
-
+$(OBJS)\test_gui_dataviewctrltest.o: ./controls/dataviewctrltest.cpp\r
+ $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
+\r
+$(OBJS)\test_gui_datepickerctrltest.o: ./controls/datepickerctrltest.cpp\r
+ $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
+\r
$(OBJS)\test_gui_frametest.o: ./controls/frametest.cpp\r
$(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
\r
$(OBJS)\test_gui_choicebooktest.obj \\r
$(OBJS)\test_gui_choicetest.obj \\r
$(OBJS)\test_gui_comboboxtest.obj \\r
- $(OBJS)\test_gui_datepickerctrltest.obj \
+ $(OBJS)\test_gui_dataviewctrltest.obj \\r
+ $(OBJS)\test_gui_datepickerctrltest.obj \\r
$(OBJS)\test_gui_frametest.obj \\r
$(OBJS)\test_gui_gaugetest.obj \\r
$(OBJS)\test_gui_gridtest.obj \\r
$(OBJS)\test_gui_comboboxtest.obj: .\controls\comboboxtest.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\comboboxtest.cpp\r
\r
-$(OBJS)\test_gui_datepickerctrltest.obj: .\controls\datepickerctrltest.cpp
- $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\datepickerctrltest.cpp
-
+$(OBJS)\test_gui_dataviewctrltest.obj: .\controls\dataviewctrltest.cpp\r
+ $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\dataviewctrltest.cpp\r
+\r
+$(OBJS)\test_gui_datepickerctrltest.obj: .\controls\datepickerctrltest.cpp\r
+ $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\datepickerctrltest.cpp\r
+\r
$(OBJS)\test_gui_frametest.obj: .\controls\frametest.cpp\r
$(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\frametest.cpp\r
\r
$(OBJS)\test_gui_choicebooktest.obj &\r
$(OBJS)\test_gui_choicetest.obj &\r
$(OBJS)\test_gui_comboboxtest.obj &\r
- $(OBJS)\test_gui_datepickerctrltest.obj &
+ $(OBJS)\test_gui_dataviewctrltest.obj &\r
+ $(OBJS)\test_gui_datepickerctrltest.obj &\r
$(OBJS)\test_gui_frametest.obj &\r
$(OBJS)\test_gui_gaugetest.obj &\r
$(OBJS)\test_gui_gridtest.obj &\r
$(OBJS)\test_gui_comboboxtest.obj : .AUTODEPEND .\controls\comboboxtest.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
\r
-$(OBJS)\test_gui_datepickerctrltest.obj : .AUTODEPEND .\controls\datepickerctrltest.cpp
- $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<
-
+$(OBJS)\test_gui_dataviewctrltest.obj : .AUTODEPEND .\controls\dataviewctrltest.cpp\r
+ $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
+\r
+$(OBJS)\test_gui_datepickerctrltest.obj : .AUTODEPEND .\controls\datepickerctrltest.cpp\r
+ $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
+\r
$(OBJS)\test_gui_frametest.obj : .AUTODEPEND .\controls\frametest.cpp\r
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
\r
controls/choicebooktest.cpp
controls/choicetest.cpp
controls/comboboxtest.cpp
+ controls/dataviewctrltest.cpp
controls/datepickerctrltest.cpp
controls/frametest.cpp
controls/gaugetest.cpp
# End Source File\r
# Begin Source File\r
\r
-SOURCE=.\controls\datepickerctrltest.cpp
-# End Source File
-# Begin Source File
-
+SOURCE=.\controls\dataviewctrltest.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\controls\datepickerctrltest.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
SOURCE=.\dummy.cpp\r
# ADD BASE CPP /Yc"testprec.h"\r
# ADD CPP /Yc"testprec.h"\r
RelativePath=".\config\config.cpp">\r
</File>\r
<File\r
- RelativePath=".\controls\datepickerctrltest.cpp">
- </File>
- <File
+ RelativePath=".\controls\dataviewctrltest.cpp">\r
+ </File>\r
+ <File\r
+ RelativePath=".\controls\datepickerctrltest.cpp">\r
+ </File>\r
+ <File\r
RelativePath=".\dummy.cpp">\r
<FileConfiguration\r
Name="Debug|Win32">\r
>\r
</File>\r
<File\r
- RelativePath=".\controls\datepickerctrltest.cpp"
- >
- </File>
- <File
+ RelativePath=".\controls\dataviewctrltest.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\controls\datepickerctrltest.cpp"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\dummy.cpp"\r
>\r
<FileConfiguration\r
>\r
</File>\r
<File\r
- RelativePath=".\controls\datepickerctrltest.cpp"
- >
- </File>
- <File
+ RelativePath=".\controls\dataviewctrltest.cpp"\r
+ >\r
+ </File>\r
+ <File\r
+ RelativePath=".\controls\datepickerctrltest.cpp"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\dummy.cpp"\r
>\r
<FileConfiguration\r