| 1 | /////////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: tests/controls/pickerbasetest.cpp |
| 3 | // Purpose: wxPickerBase unit test |
| 4 | // Author: Steven Lamerton |
| 5 | // Created: 2010-08-07 |
| 6 | // RCS-ID: $Id$ |
| 7 | // Copyright: (c) 2010 Steven Lamerton |
| 8 | /////////////////////////////////////////////////////////////////////////////// |
| 9 | |
| 10 | #include "testprec.h" |
| 11 | |
| 12 | #include "wx/pickerbase.h" |
| 13 | #include "pickerbasetest.h" |
| 14 | |
| 15 | void PickerBaseTestCase::Margin() |
| 16 | { |
| 17 | wxPickerBase* const base = GetBase(); |
| 18 | |
| 19 | CPPUNIT_ASSERT(base->HasTextCtrl()); |
| 20 | CPPUNIT_ASSERT(base->GetInternalMargin() >= 0); |
| 21 | |
| 22 | base->SetInternalMargin(15); |
| 23 | |
| 24 | CPPUNIT_ASSERT_EQUAL(15, base->GetInternalMargin()); |
| 25 | } |
| 26 | |
| 27 | void PickerBaseTestCase::Proportion() |
| 28 | { |
| 29 | wxPickerBase* const base = GetBase(); |
| 30 | |
| 31 | CPPUNIT_ASSERT(base->HasTextCtrl()); |
| 32 | |
| 33 | base->SetPickerCtrlProportion(1); |
| 34 | base->SetTextCtrlProportion(1); |
| 35 | |
| 36 | CPPUNIT_ASSERT_EQUAL(1, base->GetPickerCtrlProportion()); |
| 37 | CPPUNIT_ASSERT_EQUAL(1, base->GetTextCtrlProportion()); |
| 38 | } |
| 39 | |
| 40 | void PickerBaseTestCase::Growable() |
| 41 | { |
| 42 | wxPickerBase* const base = GetBase(); |
| 43 | |
| 44 | CPPUNIT_ASSERT(base->HasTextCtrl()); |
| 45 | |
| 46 | base->SetPickerCtrlGrowable(); |
| 47 | base->SetTextCtrlGrowable(); |
| 48 | |
| 49 | CPPUNIT_ASSERT(base->IsPickerCtrlGrowable()); |
| 50 | CPPUNIT_ASSERT(base->IsTextCtrlGrowable()); |
| 51 | |
| 52 | base->SetPickerCtrlGrowable(false); |
| 53 | base->SetTextCtrlGrowable(false); |
| 54 | |
| 55 | CPPUNIT_ASSERT(!base->IsPickerCtrlGrowable()); |
| 56 | CPPUNIT_ASSERT(!base->IsTextCtrlGrowable()); |
| 57 | } |
| 58 | |
| 59 | void PickerBaseTestCase::Controls() |
| 60 | { |
| 61 | wxPickerBase* const base = GetBase(); |
| 62 | |
| 63 | CPPUNIT_ASSERT(base->HasTextCtrl()); |
| 64 | CPPUNIT_ASSERT(base->GetTextCtrl() != NULL); |
| 65 | CPPUNIT_ASSERT(base->GetPickerCtrl() != NULL); |
| 66 | } |