+void DataViewCtrlTestCase::TestSelectionFor0and1()
+{
+ wxDataViewItemArray selections;
+
+ // Initially there is no selection.
+ CPPUNIT_ASSERT_EQUAL( 0, m_dvc->GetSelectedItemsCount() );
+ CPPUNIT_ASSERT( !m_dvc->HasSelection() );
+ CPPUNIT_ASSERT( !m_dvc->GetSelection().IsOk() );
+
+ CPPUNIT_ASSERT( !m_dvc->GetSelections(selections) );
+ CPPUNIT_ASSERT( selections.empty() );
+
+ // Select one item.
+ m_dvc->Select(m_child1);
+ CPPUNIT_ASSERT_EQUAL( 1, m_dvc->GetSelectedItemsCount() );
+ CPPUNIT_ASSERT( m_dvc->HasSelection() );
+ CPPUNIT_ASSERT( m_dvc->GetSelection().IsOk() );
+ CPPUNIT_ASSERT_EQUAL( 1, m_dvc->GetSelections(selections) );
+ CPPUNIT_ASSERT( selections[0] == m_child1 );
+}
+
+void DataViewCtrlTestCase::GetSelectionForMulti()
+{
+ wxDataViewItemArray selections;
+
+ TestSelectionFor0and1();
+
+ // Also test with more than one selected item.
+ m_dvc->Select(m_child2);
+
+ CPPUNIT_ASSERT_EQUAL( 2, m_dvc->GetSelectedItemsCount() );
+ CPPUNIT_ASSERT( m_dvc->HasSelection() );
+ CPPUNIT_ASSERT( !m_dvc->GetSelection().IsOk() );
+ CPPUNIT_ASSERT_EQUAL( 2, m_dvc->GetSelections(selections) );
+ CPPUNIT_ASSERT( selections[1] == m_child2 );
+}
+
+void DataViewCtrlTestCase::GetSelectionForSingle()
+{
+ delete m_dvc;
+ Create(0);
+
+ TestSelectionFor0and1();
+}
+