Ejemplo n.º 1
0
#include <wx/extension/item.h>
#include <wx/extension/itemdlg.h>
#include <wx/extension/managedframe.h>
#include "../test-item.h"
#include "test.h"

TEST_CASE("wxExItem", "[item]")
{
  wxPanel* panel = new wxPanel(GetFrame());
  AddPane(GetFrame(), panel);
  wxGridSizer* sizer = new wxGridSizer(3);
  panel->SetSizer(sizer);
  
  wxExItem::UseConfig(false);
  
  wxExItem item("item", "hello string", 1, ITEM_TEXTCTRL, true);
  
  REQUIRE( item.GetColumns() == 1);
  REQUIRE( item.GetInitial().As<wxString>() == "hello string");
  REQUIRE( item.GetIsRequired());
  REQUIRE( item.GetLabel() == "item");
  REQUIRE( item.GetPage().empty());
  REQUIRE( item.GetType() == ITEM_TEXTCTRL);
  REQUIRE( item.GetWindow() == nullptr);
  REQUIRE( item.GetValue().IsNull());
  REQUIRE(!item.IsRowGrowable());
  REQUIRE(!item.Apply());
  
  REQUIRE(!item.ToConfig(false));
  wxExItem::UseConfig(true);
  REQUIRE( item.ToConfig(false));
Ejemplo n.º 2
0
#include <wx/extension/managedframe.h>
#include "../test-configitem.h"
#include "test.h"

TEST_CASE("wxExConfigItem", "[item]")
{
  wxScrolledWindow* panel = new wxScrolledWindow(GetFrame());
  AddPane(GetFrame(), panel);
  wxFlexGridSizer* sizer = new wxFlexGridSizer(4);
  panel->SetSizer(sizer);
  panel->SetScrollbars(20, 20, 50, 50);
  
  wxExItem::UseConfig(true);

  // Use specific constructors.
  const wxExItem ci_empty;
  const wxExItem ci_spacer(5);
  const wxExItem ci_cb("ci-cb", ITEM_COMBOBOX);
  const wxExItem ci_cb_dir("ci-cb-dir", ITEM_COMBOBOX_DIR);
  const wxExItem ci_sp("ci-sp", 1, 5);
  const wxExItem ci_sp_d("ci-sp-d", 1.0, 5.0);
  const wxExItem ci_sl("ci-sl", 1, 5, 2, ITEM_SLIDER);
  const wxExItem ci_vl(wxLI_HORIZONTAL);
  wxExItem ci_str("ci-string", wxEmptyString);
  const wxExItem ci_hl("ci-hyper", "www.wxwidgets.org", 0,ITEM_HYPERLINKCTRL);
  wxExItem ci_st("ci-static", "HELLO", 0, ITEM_STATICTEXT);
  const wxExItem ci_int("ci-int",ITEM_TEXTCTRL_INT);
  const wxExItem ci_rb("ci-rb", {
      {0, "Zero"},
      {1, "One"},
      {2, "Two"}},