diff --git a/build/cmake/samples/CMakeLists.txt b/build/cmake/samples/CMakeLists.txt index 452af56246..40e2aacd4a 100644 --- a/build/cmake/samples/CMakeLists.txt +++ b/build/cmake/samples/CMakeLists.txt @@ -115,7 +115,7 @@ wx_add_sample(power) wx_add_sample(preferences DEPENDS wxUSE_PREFERENCES_EDITOR) wx_add_sample(printing printing.cpp printing.h DEPENDS wxUSE_PRINTING_ARCHITECTURE) wx_add_sample(propgrid propgrid.cpp propgrid_minimal.cpp sampleprops.cpp - tests.cpp sampleprops.h propgrid.h LIBRARIES wxpropgrid NAME propgriddemo DEPENDS wxUSE_PROPGRID) + sampleprops.h propgrid.h LIBRARIES wxpropgrid NAME propgriddemo DEPENDS wxUSE_PROPGRID) wx_add_sample(render FOLDER render) wx_add_sample(render DLL renddll.cpp NAME renddll FOLDER render) wx_add_sample(ribbon ribbondemo.cpp LIBRARIES wxribbon NAME ribbondemo DEPENDS wxUSE_RIBBON) diff --git a/build/cmake/tests/gui/CMakeLists.txt b/build/cmake/tests/gui/CMakeLists.txt index c3d5d6be9f..72217949b6 100644 --- a/build/cmake/tests/gui/CMakeLists.txt +++ b/build/cmake/tests/gui/CMakeLists.txt @@ -59,6 +59,7 @@ set(TEST_GUI_SRC controls/ownerdrawncomboboxtest.cpp controls/pickerbasetest.cpp controls/pickertest.cpp + controls/propgridtest.cpp controls/radioboxtest.cpp controls/radiobuttontest.cpp controls/rearrangelisttest.cpp @@ -229,3 +230,6 @@ endif() if(wxUSE_WEBVIEW) wx_exe_link_libraries(test_gui wxwebview) endif() +if(wxUSE_PROPGRID) + wx_exe_link_libraries(test_gui wxpropgrid) +endif() diff --git a/samples/propgrid/Makefile.in b/samples/propgrid/Makefile.in index d7b73301b2..2dc010da82 100644 --- a/samples/propgrid/Makefile.in +++ b/samples/propgrid/Makefile.in @@ -54,8 +54,7 @@ PROPGRID_OBJECTS = \ $(__propgrid___win32rc) \ propgrid_propgrid.o \ propgrid_propgrid_minimal.o \ - propgrid_sampleprops.o \ - propgrid_tests.o + propgrid_sampleprops.o ### Conditionally set variables: ### @@ -198,9 +197,6 @@ propgrid_propgrid_minimal.o: $(srcdir)/propgrid_minimal.cpp propgrid_sampleprops.o: $(srcdir)/sampleprops.cpp $(CXXC) -c -o $@ $(PROPGRID_CXXFLAGS) $(srcdir)/sampleprops.cpp -propgrid_tests.o: $(srcdir)/tests.cpp - $(CXXC) -c -o $@ $(PROPGRID_CXXFLAGS) $(srcdir)/tests.cpp - # Include dependency info, if present: @IF_GNU_MAKE@-include ./.deps/*.d diff --git a/samples/propgrid/makefile.gcc b/samples/propgrid/makefile.gcc index bf0eeaff70..8a2381b4f2 100644 --- a/samples/propgrid/makefile.gcc +++ b/samples/propgrid/makefile.gcc @@ -30,8 +30,7 @@ PROPGRID_OBJECTS = \ $(OBJS)\propgrid_sample_rc.o \ $(OBJS)\propgrid_propgrid.o \ $(OBJS)\propgrid_propgrid_minimal.o \ - $(OBJS)\propgrid_sampleprops.o \ - $(OBJS)\propgrid_tests.o + $(OBJS)\propgrid_sampleprops.o ### Conditionally set variables: ### @@ -221,9 +220,6 @@ $(OBJS)\propgrid_propgrid_minimal.o: ./propgrid_minimal.cpp $(OBJS)\propgrid_sampleprops.o: ./sampleprops.cpp $(CXX) -c -o $@ $(PROPGRID_CXXFLAGS) $(CPPDEPS) $< -$(OBJS)\propgrid_tests.o: ./tests.cpp - $(CXX) -c -o $@ $(PROPGRID_CXXFLAGS) $(CPPDEPS) $< - .PHONY: all clean diff --git a/samples/propgrid/makefile.unx b/samples/propgrid/makefile.unx index 922aba9a38..260c97c228 100644 --- a/samples/propgrid/makefile.unx +++ b/samples/propgrid/makefile.unx @@ -55,8 +55,7 @@ PROPGRID_CXXFLAGS = -I. `$(WX_CONFIG) --cxxflags $(WX_CONFIG_FLAGS)` $(CPPFLAGS) PROPGRID_OBJECTS = \ propgrid_propgrid.o \ propgrid_propgrid_minimal.o \ - propgrid_sampleprops.o \ - propgrid_tests.o + propgrid_sampleprops.o ### Conditionally set variables: ### @@ -102,9 +101,6 @@ propgrid_propgrid_minimal.o: ./propgrid_minimal.cpp propgrid_sampleprops.o: ./sampleprops.cpp $(CXX) -c -o $@ $(PROPGRID_CXXFLAGS) $(CPPDEPS) $< -propgrid_tests.o: ./tests.cpp - $(CXX) -c -o $@ $(PROPGRID_CXXFLAGS) $(CPPDEPS) $< - .PHONY: all install uninstall clean diff --git a/samples/propgrid/makefile.vc b/samples/propgrid/makefile.vc index d32b0b4dde..02ae88ad2a 100644 --- a/samples/propgrid/makefile.vc +++ b/samples/propgrid/makefile.vc @@ -32,8 +32,7 @@ PROPGRID_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME_4) /DWIN32 \ PROPGRID_OBJECTS = \ $(OBJS)\propgrid_propgrid.obj \ $(OBJS)\propgrid_propgrid_minimal.obj \ - $(OBJS)\propgrid_sampleprops.obj \ - $(OBJS)\propgrid_tests.obj + $(OBJS)\propgrid_sampleprops.obj PROPGRID_RESOURCES = \ $(OBJS)\propgrid_sample.res @@ -431,6 +430,3 @@ $(OBJS)\propgrid_propgrid_minimal.obj: .\propgrid_minimal.cpp $(OBJS)\propgrid_sampleprops.obj: .\sampleprops.cpp $(CXX) /c /nologo /TP /Fo$@ $(PROPGRID_CXXFLAGS) .\sampleprops.cpp -$(OBJS)\propgrid_tests.obj: .\tests.cpp - $(CXX) /c /nologo /TP /Fo$@ $(PROPGRID_CXXFLAGS) .\tests.cpp - diff --git a/samples/propgrid/propgrid.bkl b/samples/propgrid/propgrid.bkl index c49cb3676a..fa20bc026f 100644 --- a/samples/propgrid/propgrid.bkl +++ b/samples/propgrid/propgrid.bkl @@ -8,7 +8,6 @@ propgrid.cpp propgrid_minimal.cpp sampleprops.cpp - tests.cpp sampleprops.h diff --git a/samples/propgrid/propgrid.cpp b/samples/propgrid/propgrid.cpp index 237a5798fb..c44cf956cb 100644 --- a/samples/propgrid/propgrid.cpp +++ b/samples/propgrid/propgrid.cpp @@ -403,8 +403,6 @@ enum ID_GETVALUES, ID_SETVALUES, ID_SETVALUES2, - ID_RUNTESTFULL, - ID_RUNTESTPARTIAL, ID_FITCOLUMNS, ID_CHANGEFLAGSITEMS, ID_TESTINSERTCHOICE, @@ -538,9 +536,6 @@ wxBEGIN_EVENT_TABLE(FormMain, wxFrame) EVT_MENU( ID_CHANGEFLAGSITEMS, FormMain::OnChangeFlagsPropItemsClick ) - EVT_MENU( ID_RUNTESTFULL, FormMain::OnMisc ) - EVT_MENU( ID_RUNTESTPARTIAL, FormMain::OnMisc ) - EVT_MENU( ID_TESTINSERTCHOICE, FormMain::OnInsertChoice ) EVT_MENU( ID_TESTDELETECHOICE, FormMain::OnDeleteChoice ) @@ -1738,6 +1733,20 @@ void FormMain::PopulateWithLibraryConfig () pg->SetPropertyAttribute(pid,wxPG_BOOL_USE_CHECKBOX,true,wxPG_RECURSE); } +// ----------------------------------------------------------------------- + +void FormMain::AddTestProperties(wxPropertyGridPage* pg) +{ + pg->Append(new MyColourProperty("CustomColourProperty", wxPG_LABEL, *wxGREEN)); + pg->GetProperty("CustomColourProperty")->SetAutoUnspecified(true); + pg->SetPropertyEditor("CustomColourProperty", wxPGEditor_ComboBox); + + pg->SetPropertyHelpString("CustomColourProperty", + "This is a MyColourProperty from the sample app. " + "It is built by subclassing wxColourProperty."); +} + +// ----------------------------------------------------------------------- // // Handle events of the third page here. @@ -2070,9 +2079,6 @@ FormMain::FormMain(const wxString& title, const wxPoint& pos, const wxSize& size menuFile->Append(ID_RUNMINIMAL, "Run Minimal Sample" ); menuFile->AppendSeparator(); - menuFile->Append(ID_RUNTESTFULL, "Run Tests (full)" ); - menuFile->Append(ID_RUNTESTPARTIAL, "Run Tests (fast)" ); - menuFile->AppendSeparator(); menuFile->Append(ID_QUIT, "E&xit\tAlt-X", "Quit this program" ); // Now append the freshly created menu to the menu bar... @@ -3067,16 +3073,6 @@ void FormMain::OnMisc ( wxCommandEvent& event ) m_pPropGridManager->Collapse(selProp); } } - else if ( id == ID_RUNTESTFULL ) - { - // Runs a regression test. - RunTests(true); - } - else if ( id == ID_RUNTESTPARTIAL ) - { - // Runs a regression test. - RunTests(false); - } else if ( id == ID_UNSPECIFY ) { wxPGProperty* prop = m_pPropGridManager->GetSelection(); @@ -3108,6 +3104,64 @@ void FormMain::OnPopulateClick( wxCommandEvent& event ) // ----------------------------------------------------------------------- +void FormMain::OnDumpList(wxCommandEvent& WXUNUSED(event)) +{ + wxVariant values = m_pPropGridManager->GetPropertyValues("list", wxNullProperty, wxPG_INC_ATTRIBUTES); + wxString text = "This only tests that wxVariant related routines do not crash.\n"; + + wxDialog* dlg = new wxDialog(this, wxID_ANY, "wxVariant Test", + wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); + + for ( size_t i = 0; i < values.GetCount(); i++ ) + { + wxString t; + wxVariant& v = values[i]; + + wxString strValue = v.GetString(); + + if ( v.GetName().EndsWith("@attr") ) + { + text += wxString::Format("Attributes:\n"); + + for ( size_t n = 0; n < v.GetCount(); n++ ) + { + wxVariant& a = v[n]; + + t.Printf(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n", (int)n, + a.GetName(), a.GetType(), a.GetString()); + text += t; + } + } + else + { + t.Printf("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n", (int)i, + v.GetName(), v.GetType(), strValue); + text += t; + } + } + + // multi-line text editor dialog + const int spacing = 8; + wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL); + wxBoxSizer* rowsizer = new wxBoxSizer(wxHORIZONTAL); + wxTextCtrl* ed = new wxTextCtrl(dlg, wxID_ANY, text, + wxDefaultPosition, wxDefaultSize, + wxTE_MULTILINE | wxTE_READONLY); + rowsizer->Add(ed, wxSizerFlags(1).Expand().Border(wxALL, spacing)); + topsizer->Add(rowsizer, wxSizerFlags(1).Expand()); + rowsizer = new wxBoxSizer(wxHORIZONTAL); + rowsizer->Add(new wxButton(dlg, wxID_OK, "Ok"), + wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM | wxLEFT | wxRIGHT, spacing)); + topsizer->Add(rowsizer, wxSizerFlags().Right()); + + dlg->SetSizer(topsizer); + topsizer->SetSizeHints(dlg); + + dlg->SetSize(400, 300); + dlg->Centre(); + dlg->ShowModal(); +} + void DisplayMinimalFrame(wxWindow* parent); // in minimal.cpp void FormMain::OnRunMinimalClick( wxCommandEvent& WXUNUSED(event) ) @@ -3138,23 +3192,6 @@ bool cxApplication::OnInit() FormMain* frame = new FormMain( "wxPropertyGrid Sample", wxPoint(0,0), frameSize); frame->Show(true); - // - // Parse command-line - wxApp& app = wxGetApp(); - if ( app.argc > 1 ) - { - wxString s = app.argv[1]; - if ( s == "--run-tests" ) - { - // - // Run tests - bool testResult = frame->RunTests(true); - - if ( testResult ) - return false; - } - } - return true; } diff --git a/samples/propgrid/propgrid.h b/samples/propgrid/propgrid.h index 47d389ad32..d3486a4071 100644 --- a/samples/propgrid/propgrid.h +++ b/samples/propgrid/propgrid.h @@ -233,8 +233,6 @@ public: void AddTestProperties( wxPropertyGridPage* pg ); - bool RunTests( bool fullTest, bool interactive = false ); - private: wxDECLARE_EVENT_TABLE(); }; diff --git a/samples/propgrid/sampleprops.cpp b/samples/propgrid/sampleprops.cpp index 439867df5e..ef7ee6ccda 100644 --- a/samples/propgrid/sampleprops.cpp +++ b/samples/propgrid/sampleprops.cpp @@ -656,3 +656,67 @@ bool wxArrayDoubleProperty::ValidateValue(wxVariant& value, return true; } + +// ----------------------------------------------------------------------- +// MyColourProperty +// ----------------------------------------------------------------------- + +// Test customizing wxColourProperty via subclassing +// * Includes custom colour entry. +// * Includes extra custom entry. +MyColourProperty::MyColourProperty(const wxString& label, + const wxString& name, + const wxColour& value) + : wxColourProperty(label, name, value) +{ + wxPGChoices colours; + colours.Add("White"); + colours.Add("Black"); + colours.Add("Red"); + colours.Add("Green"); + colours.Add("Blue"); + colours.Add("Custom"); + colours.Add("None"); + m_choices = colours; + SetIndex(0); + wxVariant variant; + variant << value; + SetValue(variant); +} + +wxColour MyColourProperty::GetColour(int index) const +{ + switch ( index ) + { + case 0: return *wxWHITE; + case 1: return *wxBLACK; + case 2: return *wxRED; + case 3: return *wxGREEN; + case 4: return *wxBLUE; + case 5: + // Return current colour for the custom entry + wxColour col; + if ( GetIndex() == GetCustomColourIndex() ) + { + if ( m_value.IsNull() ) + return col; + col << m_value; + return col; + } + return *wxWHITE; + } + return wxColour(); +} + +wxString MyColourProperty::ColourToString(const wxColour& col, int index, int argFlags) const +{ + if ( index == (int)(m_choices.GetCount() - 1) ) + return wxEmptyString; + + return wxColourProperty::ColourToString(col, index, argFlags); +} + +int MyColourProperty::GetCustomColourIndex() const +{ + return m_choices.GetCount() - 2; +} diff --git a/samples/propgrid/sampleprops.h b/samples/propgrid/sampleprops.h index 4fdaf9a108..ecb4dd5fb5 100644 --- a/samples/propgrid/sampleprops.h +++ b/samples/propgrid/sampleprops.h @@ -140,4 +140,21 @@ protected: // ----------------------------------------------------------------------- +class MyColourProperty : public wxColourProperty +{ +public: + MyColourProperty(const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxColour& value = *wxWHITE); + + virtual ~MyColourProperty() = default; + + virtual wxColour GetColour(int index) const override; + + virtual wxString ColourToString(const wxColour& col, + int index, int argFlags = 0) const override; + + virtual int GetCustomColourIndex() const override; +}; + #endif // _WX_SAMPLES_PROPGRID_SAMPLEPROPS_H_ diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp deleted file mode 100644 index 0a86f56e49..0000000000 --- a/samples/propgrid/tests.cpp +++ /dev/null @@ -1,1926 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: samples/propgrid/tests.cpp -// Purpose: wxPropertyGrid tests -// Author: Jaakko Salli -// Modified by: -// Created: 2007-05-16 -// Copyright: (c) Jaakko Salli -// Licence: wxWindows licence -///////////////////////////////////////////////////////////////////////////// - -#include "wx/wxprec.h" - - -#ifndef WX_PRECOMP - #include "wx/wx.h" -#endif - -#include "wx/propgrid/propgrid.h" -#include "wx/propgrid/advprops.h" -#include "wx/propgrid/manager.h" - -#include "propgrid.h" -#include "sampleprops.h" - - -// ----------------------------------------------------------------------- -// wxTestCustomFlagsProperty -// ----------------------------------------------------------------------- - -// -// Test customizing wxColourProperty via subclassing -// -// * Includes custom colour entry. -// * Includes extra custom entry. -// -class MyColourProperty : public wxColourProperty -{ -public: - MyColourProperty( const wxString& label = wxPG_LABEL, - const wxString& name = wxPG_LABEL, - const wxColour& value = *wxWHITE ) - : wxColourProperty(label, name, value) - { - wxPGChoices colours; - colours.Add("White"); - colours.Add("Black"); - colours.Add("Red"); - colours.Add("Green"); - colours.Add("Blue"); - colours.Add("Custom"); - colours.Add("None"); - m_choices = colours; - SetIndex(0); - wxVariant variant; - variant << value; - SetValue(variant); - } - - virtual ~MyColourProperty() - { - } - - virtual wxColour GetColour( int index ) const override - { - switch (index) - { - case 0: return *wxWHITE; - case 1: return *wxBLACK; - case 2: return *wxRED; - case 3: return *wxGREEN; - case 4: return *wxBLUE; - case 5: - // Return current colour for the custom entry - wxColour col; - if ( GetIndex() == GetCustomColourIndex() ) - { - if ( m_value.IsNull() ) - return col; - col << m_value; - return col; - } - return *wxWHITE; - } - return wxColour(); - } - - virtual wxString ColourToString( const wxColour& col, - int index, - int argFlags = 0 ) const override - { - if ( index == (int)(m_choices.GetCount()-1) ) - return wxEmptyString; - - return wxColourProperty::ColourToString(col, index, argFlags); - } - - virtual int GetCustomColourIndex() const override - { - return m_choices.GetCount()-2; - } -}; - - -void FormMain::AddTestProperties( wxPropertyGridPage* pg ) -{ - pg->Append( new MyColourProperty("CustomColourProperty", wxPG_LABEL, *wxGREEN) ); - pg->GetProperty("CustomColourProperty")->SetAutoUnspecified(true); - pg->SetPropertyEditor( "CustomColourProperty", wxPGEditor_ComboBox ); - - pg->SetPropertyHelpString("CustomColourProperty", - "This is a MyColourProperty from the sample app. " - "It is built by subclassing wxColourProperty."); -} - -// ----------------------------------------------------------------------- - -void FormMain::OnDumpList( wxCommandEvent& WXUNUSED(event) ) -{ - wxVariant values = m_pPropGridManager->GetPropertyValues("list", wxNullProperty, wxPG_INC_ATTRIBUTES); - wxString text = "This only tests that wxVariant related routines do not crash.\n"; - - wxDialog* dlg = new wxDialog(this,wxID_ANY,"wxVariant Test", - wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); - - for ( size_t i = 0; i < values.GetCount(); i++ ) - { - wxString t; - wxVariant& v = values[i]; - - wxString strValue = v.GetString(); - - if ( v.GetName().EndsWith("@attr") ) - { - text += wxString::Format("Attributes:\n"); - - for ( size_t n = 0; n < v.GetCount(); n++ ) - { - wxVariant& a = v[n]; - - t.Printf(" attribute %i: name=\"%s\" (type=\"%s\" value=\"%s\")\n",(int)n, - a.GetName(),a.GetType(),a.GetString()); - text += t; - } - } - else - { - t.Printf("%i: name=\"%s\" type=\"%s\" value=\"%s\"\n",(int)i, - v.GetName(),v.GetType(),strValue); - text += t; - } - } - - // multi-line text editor dialog - const int spacing = 8; - wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL ); - wxTextCtrl* ed = new wxTextCtrl(dlg, wxID_ANY, text, - wxDefaultPosition, wxDefaultSize, - wxTE_MULTILINE|wxTE_READONLY); - rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing)); - topsizer->Add( rowsizer, wxSizerFlags(1).Expand()); - rowsizer = new wxBoxSizer( wxHORIZONTAL ); - rowsizer->Add( new wxButton(dlg,wxID_OK,"Ok"), - wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing)); - topsizer->Add( rowsizer, wxSizerFlags().Right() ); - - dlg->SetSizer( topsizer ); - topsizer->SetSizeHints( dlg ); - - dlg->SetSize(400,300); - dlg->Centre(); - dlg->ShowModal(); -} - -// ----------------------------------------------------------------------- - -class TestRunner -{ -public: - - TestRunner( const wxString& name, wxPropertyGridManager* man, wxTextCtrl* ed, wxVector* errorMessages ) - { - m_name = name; - m_man = man; - m_ed = ed; - m_errorMessages = errorMessages; -#ifdef __WXDEBUG__ - m_preWarnings = wxPGGlobalVars->m_warnings; -#endif - - if ( name != "none" ) - Msg(name+"\n"); - } - - ~TestRunner() - { -#ifdef __WXDEBUG__ - int warningsOccurred = wxPGGlobalVars->m_warnings - m_preWarnings; - if ( warningsOccurred ) - { - wxString s = wxString::Format("%i warnings occurred during test '%s'", warningsOccurred, m_name); - m_errorMessages->push_back(s); - Msg(s); - } -#endif - } - - void Msg( const wxString& text ) - { - if ( m_ed ) - { - m_ed->AppendText(text); - m_ed->AppendText("\n"); - } - wxLogDebug(text); - } - -protected: - wxPropertyGridManager* m_man; - wxTextCtrl* m_ed; - wxVector* m_errorMessages; - wxString m_name; -#ifdef __WXDEBUG__ - int m_preWarnings; -#endif -}; - - -#define RT_START_TEST(TESTNAME) \ - TestRunner tr(#TESTNAME, pgman, ed, &errorMessages); - -#define RT_MSG(S) \ - tr.Msg(S); - -#define RT_FAILURE() \ - { \ - wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \ - errorMessages.push_back(s1); \ - wxLogDebug(s1); \ - failures++; \ - } - -#define RT_ASSERT(COND) \ - if (!(COND)) \ - RT_FAILURE() - -#define RT_FAILURE_MSG(MSG) \ - { \ - wxString s1 = wxString::Format("Test failure in tests.cpp, line %i.",__LINE__-1); \ - errorMessages.push_back(s1); \ - wxLogDebug(s1); \ - wxString s2 = wxString::Format("Message: %s",MSG); \ - errorMessages.push_back(s2); \ - wxLogDebug(s2); \ - failures++; \ - } - -#define RT_VALIDATE_VIRTUAL_HEIGHT(PROPS, EXTRATEXT) \ - { \ - unsigned int h1_ = PROPS->GetVirtualHeight(); \ - unsigned int h2_ = PROPS->GetActualVirtualHeight(); \ - if ( h1_ != h2_ ) \ - { \ - wxString s_ = wxString::Format("VirtualHeight = %i, should be %i (%s)", h1_, h2_, EXTRATEXT); \ - RT_FAILURE_MSG(s_); \ - _failed_ = true; \ - } \ - else \ - { \ - _failed_ = false; \ - } \ - } - -inline bool GetRandomBooleanVal() -{ - return (rand() % 2) != 0; -} - -extern "C" -int gpiro_cmpfunc(const void* a, const void* b) -{ - const wxPGProperty* p1 = *static_cast(a); - const wxPGProperty* p2 = *static_cast(b); - return (int) (((size_t)p1->GetClientData()) - ((size_t)p2->GetClientData())); -} - -wxVector GetPropertiesInRandomOrder( wxPropertyGridInterface* props, int iterationFlags = wxPG_ITERATE_ALL ) -{ - wxVector arr; - - wxPropertyGridIterator it; - - for ( it = props->GetIterator(iterationFlags); - !it.AtEnd(); - ++it ) - { - wxPGProperty* p = *it; - size_t randomNumber = rand(); - p->SetClientData(reinterpret_cast(randomNumber)); - arr.push_back(p); - } - - wxPGProperty** firstEntry = &arr[0]; - qsort(firstEntry, arr.size(), sizeof(wxPGProperty*), gpiro_cmpfunc); - - return arr; -} - -// Callback for testing property sorting -int MyPropertySortFunction(wxPropertyGrid* WXUNUSED(propGrid), - wxPGProperty* p1, - wxPGProperty* p2) -{ - // Reverse alphabetical order - return p2->GetLabel().CmpNoCase( p1->GetBaseName() ); -} - -bool FormMain::RunTests( bool fullTest, bool interactive ) -{ - wxString t; - - wxPropertyGridManager* pgman = m_pPropGridManager; - wxPropertyGrid* pg; - - size_t i; - - pgman->ClearSelection(); - - srand((unsigned int)(time(nullptr) % UINT_MAX)); - - int failures = 0; - bool _failed_ = false; - wxVector errorMessages; - wxDialog* dlg = nullptr; - - dlg = new wxDialog(this,wxID_ANY,"wxPropertyGrid Regression Tests", - wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER); - - // multi-line text editor dialog - const int spacing = 8; - wxBoxSizer* topsizer = new wxBoxSizer( wxVERTICAL ); - wxBoxSizer* rowsizer = new wxBoxSizer( wxHORIZONTAL ); - wxTextCtrl* ed = new wxTextCtrl(dlg, wxID_ANY, wxEmptyString, - wxDefaultPosition, wxDefaultSize, - wxTE_MULTILINE|wxTE_READONLY); - rowsizer->Add( ed, wxSizerFlags(1).Expand().Border(wxALL, spacing)); - topsizer->Add( rowsizer, wxSizerFlags(1).Expand()); - rowsizer = new wxBoxSizer( wxHORIZONTAL ); - rowsizer->Add( new wxButton(dlg,wxID_OK,"Ok"), - wxSizerFlags(0).CentreHorizontal().CentreVertical().Border(wxBOTTOM|wxLEFT|wxRIGHT, spacing)); - topsizer->Add( rowsizer, wxSizerFlags().Right() ); - - dlg->SetSizer( topsizer ); - topsizer->SetSizeHints( dlg ); - - dlg->SetSize(400,300); - dlg->Move(wxSystemSettings::GetMetric(wxSYS_SCREEN_X)-dlg->GetSize().x, - wxSystemSettings::GetMetric(wxSYS_SCREEN_Y)-dlg->GetSize().y); - dlg->Show(); - - { - // - // Basic iterator tests - RT_START_TEST(GetIterator) - - wxPGVIterator it; - int count; - - count = 0; - for ( it = pgman->GetVIterator(wxPG_ITERATE_PROPERTIES); - !it.AtEnd(); - it.Next() ) - { - wxPGProperty* p = it.GetProperty(); - if ( p->IsCategory() ) - RT_FAILURE_MSG(wxString::Format("'%s' is a category (non-private child property expected)",p->GetLabel())) - else if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) - RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property expected)",p->GetLabel())) - count++; - } - - RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES) -> %i entries", count)); - - count = 0; - for ( it = pgman->GetVIterator(wxPG_ITERATE_CATEGORIES); - !it.AtEnd(); - it.Next() ) - { - wxPGProperty* p = it.GetProperty(); - if ( !p->IsCategory() ) - RT_FAILURE_MSG(wxString::Format("'%s' is not a category (only category was expected)",p->GetLabel())) - count++; - } - - RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_CATEGORIES) -> %i entries", count)); - - count = 0; - for ( it = pgman->GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES); - !it.AtEnd(); - it.Next() ) - { - wxPGProperty* p = it.GetProperty(); - if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) - RT_FAILURE_MSG(wxString::Format("'%s' is a private child (non-private child property or category expected)",p->GetLabel())) - count++; - } - - RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES) -> %i entries", count)); - - count = 0; - for ( it = pgman->GetVIterator(wxPG_ITERATE_VISIBLE); - !it.AtEnd(); - it.Next() ) - { - wxPGProperty* p = it.GetProperty(); - if ( (p->GetParent() != p->GetGrid()->GetRoot() && !p->GetParent()->IsExpanded()) ) - RT_FAILURE_MSG(wxString::Format("'%s' had collapsed parent (only visible properties expected)",p->GetLabel())) - else if ( p->HasFlag(wxPG_PROP_HIDDEN) ) - RT_FAILURE_MSG(wxString::Format("'%s' was hidden (only visible properties expected)",p->GetLabel())) - count++; - } - - RT_MSG(wxString::Format("GetVIterator(wxPG_ITERATE_VISIBLE) -> %i entries", count)); - } - - if ( fullTest ) - { - // Test that setting focus to properties does not crash things - RT_START_TEST(SelectProperty) - - wxPropertyGridIterator it; - size_t ind; - - for ( ind=0; indGetPageCount(); ind++ ) - { - wxPropertyGridPage* page = pgman->GetPage(ind); - pgman->SelectPage(page); - - for ( it = page->GetIterator(wxPG_ITERATE_VISIBLE); - !it.AtEnd(); - ++it ) - { - wxPGProperty* p = *it; - RT_MSG(p->GetLabel()); - pgman->GetGrid()->SelectProperty(p, true); - ::wxMilliSleep(150); - Update(); - } - } - } - - { - // - // Delete everything in reverse order - RT_START_TEST(DeleteProperty) - - wxPGVIterator it; - wxVector array; - - for ( it = pgman->GetVIterator(wxPG_ITERATE_ALL&~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE))); - !it.AtEnd(); - it.Next() ) - array.push_back(it.GetProperty()); - - wxVector::reverse_iterator it2; - - for ( it2 = array.rbegin(); it2 != array.rend(); ++it2 ) - { - wxPGProperty* p = *it2; - RT_MSG(wxString::Format("Deleting '%s' ('%s')",p->GetLabel(),p->GetName())); - pgman->DeleteProperty(p); - } - - // Check if grid is empty. - it = pgman->GetVIterator(wxPG_ITERATE_ALL&~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE))); - if ( !it.AtEnd() ) - { - RT_FAILURE_MSG(wxString("Not all properties are deleted")); - } - - // Recreate grid - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - } - - { - // - // Test property default values - RT_START_TEST(Default_Values) - - wxPGVIterator it; - - for ( it = pgman->GetVIterator(wxPG_ITERATE_PROPERTIES); - !it.AtEnd(); - it.Next() ) - { - wxPGProperty* p = it.GetProperty(); - pgman->SetPropertyValue(p, p->GetDefaultValue()); - } - - // Recreate grid - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - } - - { - // - // Test wxAny<->wxVariant conversion - RT_START_TEST(WXVARIANT_TO_WXANY_CONVERSION) - - wxPGProperty* prop; - wxAny any; - -#if wxUSE_DATETIME - prop = pgman->GetProperty("DateProperty"); - wxDateTime testTime = wxDateTime::Now(); - any = testTime; - prop->SetValue(any); - if ( prop->GetValue().GetAny().As() != testTime ) - RT_FAILURE(); -#endif - - prop = pgman->GetProperty("IntProperty"); - int testInt = 25537983; - any = testInt; - prop->SetValue(any); - if ( prop->GetValue().GetAny().As() != testInt ) - RT_FAILURE(); -#ifdef wxLongLong_t - if ( prop->GetValue().GetAny().As() != testInt ) - RT_FAILURE(); -#endif - - prop = pgman->GetProperty("StringProperty"); - wxString testString = "asd934jfyn3"; - any = testString; - prop->SetValue(any); - if ( prop->GetValue().GetAny().As() != testString ) - RT_FAILURE(); - - // Test with a type generated with IMPLEMENT_VARIANT_OBJECT() - prop = pgman->GetProperty("ColourProperty"); - wxColour testCol = *wxCYAN; - any = testCol; - prop->SetValue(any); - if ( prop->GetValue().GetAny().As() != testCol ) - RT_FAILURE(); - - // Test with a type with custom wxVariantData defined by - // wxPG headers. - prop = pgman->GetProperty("Position"); - wxPoint testPoint(199, 199); - any = testPoint; - prop->SetValue(any); - if ( prop->GetValue().GetAny().As() != testPoint ) - RT_FAILURE(); - } - - { - RT_START_TEST(GetPropertyValues) - - for ( i=0; i<3; i++ ) - { - wxString text; - - wxPropertyGridPage* page = pgman->GetPage(i); - - wxVariant values = page->GetPropertyValues(); - - for (unsigned int j = 0; j < (unsigned int)values.GetCount(); j++ ) - { - wxVariant& v = values[j]; - - t.Printf("%i: name=\"%s\" type=\"%s\"\n",(int)j, - v.GetName(),v.GetType()); - - text += t; - } - ed->AppendText(text); - } - } - - { - RT_START_TEST(SetPropertyValue_and_GetPropertyValue) - - // In this section, mixed up usage of "propname" and "propname" - // in wxPropertyGridInterface functions is intentional. - // Purpose is to test wxPGPropArgCls ctors. - - //pg = nullptr; - - wxArrayString test_arrstr_1; - test_arrstr_1.Add("Apple"); - test_arrstr_1.Add("Orange"); - test_arrstr_1.Add("Lemon"); - - wxArrayString test_arrstr_2; - test_arrstr_2.Add("Potato"); - test_arrstr_2.Add("Cabbage"); - test_arrstr_2.Add("Cucumber"); - - wxArrayInt test_arrint_1; - test_arrint_1.Add(1); - test_arrint_1.Add(2); - test_arrint_1.Add(3); - - wxArrayInt test_arrint_2; - test_arrint_2.Add(0); - test_arrint_2.Add(1); - test_arrint_2.Add(4); - -#if wxUSE_DATETIME - wxDateTime dt1 = wxDateTime::Now(); - dt1.SetYear(dt1.GetYear()-1); - - wxDateTime dt2 = wxDateTime::Now(); - dt2.SetYear(dt2.GetYear()-10); -#endif - - wxColour colWithAlpha(1, 128, 254, 100); - wxString colWithAlphaStr(colWithAlpha.GetAsString(wxC2S_CSS_SYNTAX)); - -#define FLAG_TEST_SET1 (wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER) -#define FLAG_TEST_SET2 (wxSTAY_ON_TOP|wxCAPTION|wxICONIZE|wxSYSTEM_MENU) - - pgman->SetPropertyValue("StringProperty","Text1"); - pgman->SetPropertyValue("IntProperty",1024); - pgman->SetPropertyValue("FloatProperty",1024.0000000001); - pgman->SetPropertyValue("BoolProperty",false); - pgman->SetPropertyValue("EnumProperty",120); - pgman->SetPropertyValue("ArrayStringProperty",test_arrstr_1); - wxColour emptyCol; - pgman->SetPropertyValue("ColourProperty",emptyCol); - pgman->SetPropertyValue("ColourProperty", const_cast(static_cast(wxBLACK))); - pgman->SetPropertyValue("Size",WXVARIANT(wxSize(150,150))); - pgman->SetPropertyValue("Position",WXVARIANT(wxPoint(150,150))); - pgman->SetPropertyValue("MultiChoiceProperty",test_arrint_1); -#if wxUSE_DATETIME - pgman->SetPropertyValue("DateProperty",dt1); -#endif - - pgman->SelectPage(2); - pg = pgman->GetGrid(); - - if ( pg->GetPropertyValueAsString("StringProperty") != "Text1" ) - RT_FAILURE(); - if ( pg->GetPropertyValueAsInt("IntProperty") != 1024 ) - RT_FAILURE(); - if ( pg->GetPropertyValueAsDouble("FloatProperty") != 1024.0000000001 ) - RT_FAILURE(); - if ( pg->GetPropertyValueAsBool("BoolProperty") != false ) - RT_FAILURE(); - if ( pg->GetPropertyValueAsLong("EnumProperty") != 120 ) - RT_FAILURE(); - if ( pg->GetPropertyValueAsArrayString("ArrayStringProperty") != test_arrstr_1 ) - RT_FAILURE(); - wxColour col; - col << pgman->GetPropertyValue("ColourProperty"); - if ( col != *wxBLACK ) - RT_FAILURE(); - wxVariant varSize(pg->GetPropertyValue("Size")); - if ( wxSizeRefFromVariant(varSize) != wxSize(150,150) ) - RT_FAILURE(); - wxVariant varPos(pg->GetPropertyValue("Position")); - if ( wxPointRefFromVariant(varPos) != wxPoint(150,150) ) - RT_FAILURE(); - if ( !(pg->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_1) ) - RT_FAILURE(); -#if wxUSE_DATETIME - if ( !(pg->GetPropertyValueAsDateTime("DateProperty") == dt1) ) - RT_FAILURE(); -#endif - -#if wxUSE_LONGLONG && defined(wxLongLong_t) - pgman->SetPropertyValue("IntProperty",wxLL(10000000000)); - if ( pg->GetPropertyValueAsLongLong("IntProperty") != wxLL(10000000000) ) - RT_FAILURE(); -#else - pgman->SetPropertyValue("IntProperty",1000000000); - if ( pg->GetPropertyValueAsLong("IntProperty") != 1000000000 ) - RT_FAILURE(); -#endif - - pg->SetPropertyValue("StringProperty","Text2"); - pg->SetPropertyValue("IntProperty",512); - pg->SetPropertyValue("FloatProperty",512.0); - pg->SetPropertyValue("BoolProperty",true); - pg->SetPropertyValue("EnumProperty",80); - pg->SetPropertyValue("ArrayStringProperty",test_arrstr_2); - pg->SetPropertyValue("ColourProperty", const_cast(static_cast(wxWHITE))); - pg->SetPropertyValue("Size",WXVARIANT(wxSize(300,300))); - pg->SetPropertyValue("Position",WXVARIANT(wxPoint(300,300))); - pg->SetPropertyValue("MultiChoiceProperty",test_arrint_2); -#if wxUSE_DATETIME - pg->SetPropertyValue("DateProperty",dt2); -#endif - - //pg = nullptr; - - pgman->SelectPage(0); - - if ( pgman->GetPropertyValueAsString("StringProperty") != "Text2" ) - RT_FAILURE(); - if ( pgman->GetPropertyValueAsInt("IntProperty") != 512 ) - RT_FAILURE(); - if ( pgman->GetPropertyValueAsDouble("FloatProperty") != 512.0 ) - RT_FAILURE(); - if ( pgman->GetPropertyValueAsBool("BoolProperty") != true ) - RT_FAILURE(); - if ( pgman->GetPropertyValueAsLong("EnumProperty") != 80 ) - RT_FAILURE(); - if ( pgman->GetPropertyValueAsArrayString("ArrayStringProperty") != test_arrstr_2 ) - RT_FAILURE(); - col << pgman->GetPropertyValue("ColourProperty"); - if ( col != *wxWHITE ) - RT_FAILURE(); - varSize = pgman->GetPropertyValue("Size"); - if ( wxSizeRefFromVariant(varSize) != wxSize(300,300) ) - RT_FAILURE(); - varPos = pgman->GetPropertyValue("Position"); - if ( wxPointRefFromVariant(varPos) != wxPoint(300,300) ) - RT_FAILURE(); - if ( !(pgman->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_2) ) - RT_FAILURE(); -#if wxUSE_DATETIME - if ( !(pgman->GetPropertyValueAsDateTime("DateProperty") == dt2) ) - RT_FAILURE(); -#endif - -#if wxUSE_LONGLONG && defined(wxLongLong_t) - pgman->SetPropertyValue("IntProperty",wxLL(-80000000000)); - if ( pgman->GetPropertyValueAsLongLong("IntProperty") != wxLL(-80000000000) ) - RT_FAILURE(); -#else - pgman->SetPropertyValue("IntProperty",-1000000000); - if ( pgman->GetPropertyValueAsLong("IntProperty") != -1000000000 ) - RT_FAILURE(); -#endif - - // Make sure children of composite parent get updated as well - // Original string value: "Lamborghini Diablo SV; 5707; [300; 3.9; 8.6] 300000; Not Convertible" - - // - // This updates children as well - wxString nvs = "Lamborghini Diablo XYZ; 5707; [100; 3.9; 8.6] 3000002; Convertible"; - pgman->SetPropertyValue("Car", nvs); - - if ( pgman->GetPropertyValueAsString("Car.Model") != "Lamborghini Diablo XYZ" ) - { - RT_FAILURE_MSG(wxString::Format("Did not match: Car.Model=%s", pgman->GetPropertyValueAsString("Car.Model"))); - } - - if ( pgman->GetPropertyValueAsInt("Car.Speeds.Max. Speed (mph)") != 100 ) - { - RT_FAILURE_MSG(wxString::Format("Did not match: Car.Speeds.Max. Speed (mph)=%s", pgman->GetPropertyValueAsString("Car.Speeds.Max. Speed (mph)"))); - } - - if ( pgman->GetPropertyValueAsInt("Car.Price ($)") != 3000002 ) - { - RT_FAILURE_MSG(wxString::Format(wxS("Did not match: Car.Price ($)=%s"), pgman->GetPropertyValueAsString(wxS("Car.Price ($)")))); - } - - if ( !pgman->GetPropertyValueAsBool("Car.Convertible") ) - { - RT_FAILURE_MSG(wxString::Format("Did not match: Car.Convertible=%s", pgman->GetPropertyValueAsString("Car.Convertible"))); - } - - // SetPropertyValueString for special cases such as wxColour - pgman->SetPropertyValueString("ColourProperty", "(123,4,255)"); - col << pgman->GetPropertyValue("ColourProperty"); - if ( col != wxColour(123, 4, 255) ) - RT_FAILURE(); - pgman->SetPropertyValueString("ColourProperty", "#FE860B"); - col << pgman->GetPropertyValue("ColourProperty"); - if ( col != wxColour(254, 134, 11) ) - RT_FAILURE(); - - pgman->SetPropertyValueString("ColourPropertyWithAlpha", - "(10, 20, 30, 128)"); - col << pgman->GetPropertyValue("ColourPropertyWithAlpha"); - if ( col != wxColour(10, 20, 30, 128) ) - RT_FAILURE(); - if ( pgman->GetPropertyValueAsString("ColourPropertyWithAlpha") - != "(10,20,30,128)" ) - RT_FAILURE(); - } - - { - RT_START_TEST(SetPropertyValueUnspecified) - - // Null variant setter tests - pgman->SetPropertyValueUnspecified("StringProperty"); - pgman->SetPropertyValueUnspecified("IntProperty"); - pgman->SetPropertyValueUnspecified("FloatProperty"); - pgman->SetPropertyValueUnspecified("BoolProperty"); - pgman->SetPropertyValueUnspecified("EnumProperty"); - pgman->SetPropertyValueUnspecified("ArrayStringProperty"); - pgman->SetPropertyValueUnspecified("ColourProperty"); - pgman->SetPropertyValueUnspecified("Size"); - pgman->SetPropertyValueUnspecified("Position"); - pgman->SetPropertyValueUnspecified("MultiChoiceProperty"); -#if wxUSE_DATETIME - pgman->SetPropertyValueUnspecified("DateProperty"); -#endif - } - - { - // - // Test multiple selection - RT_START_TEST(MULTIPLE_SELECTION) - if ( !(pgman->GetExtraStyle() & wxPG_EX_MULTIPLE_SELECTION) ) - ReplaceGrid( -1, wxPG_EX_MULTIPLE_SELECTION); - pgman = m_pPropGridManager; - - pg = pgman->GetGrid(); - - wxPGProperty* prop1 = pg->GetProperty("Label"); - wxPGProperty* prop2 = pg->GetProperty("Cell Text Colour"); - wxPGProperty* prop3 = pg->GetProperty("Height"); - wxPGProperty* catProp = pg->GetProperty("Appearance"); - - RT_ASSERT( prop1 && prop2 && prop3 ); - - pg->ClearSelection(); - pg->AddToSelection(prop1); - pg->AddToSelection(prop2); - pg->AddToSelection(prop3); - - // Adding category to selection should fail silently - pg->AddToSelection(catProp); - - wxArrayPGProperty selectedProperties = pg->GetSelectedProperties(); - - RT_ASSERT( selectedProperties.size() == 3 ) - RT_ASSERT( pg->IsPropertySelected(prop1) ) - RT_ASSERT( pg->IsPropertySelected(prop2) ) - RT_ASSERT( pg->IsPropertySelected(prop3) ) - RT_ASSERT( !pg->IsPropertySelected(catProp) ) - - pg->RemoveFromSelection(prop1); - wxArrayPGProperty selectedProperties2 = pg->GetSelectedProperties(); - - RT_ASSERT( selectedProperties2.size() == 2 ) - RT_ASSERT( !pg->IsPropertySelected(prop1) ) - RT_ASSERT( pg->IsPropertySelected(prop2) ) - RT_ASSERT( pg->IsPropertySelected(prop3) ) - - pg->ClearSelection(); - - wxArrayPGProperty selectedProperties3 = pg->GetSelectedProperties(); - - RT_ASSERT( selectedProperties3.size() == 0 ) - RT_ASSERT( !pg->IsPropertySelected(prop1) ) - RT_ASSERT( !pg->IsPropertySelected(prop2) ) - RT_ASSERT( !pg->IsPropertySelected(prop3) ) - - pg->SelectProperty(prop2); - - RT_ASSERT( !pg->IsPropertySelected(prop1) ) - RT_ASSERT( pg->IsPropertySelected(prop2) ) - RT_ASSERT( !pg->IsPropertySelected(prop3) ) - } - - { - // - // Test retrieving main parent of the property - RT_START_TEST(GetMainParent) - pgman = m_pPropGridManager; - - // Simple properties - wxPGProperty* prop = pgman->GetProperty("DateProperty"); - wxPGProperty* parent = prop->GetMainParent(); - RT_ASSERT(parent->GetName() == "DateProperty"); - - prop = pgman->GetProperty("Label"); - parent = prop->GetMainParent(); - RT_ASSERT(parent->GetName() == "Label"); - - // Properties with children - prop = pgman->GetProperty("Font"); - RT_ASSERT(prop); - parent = prop->GetMainParent(); - RT_ASSERT(parent); - RT_ASSERT(parent->GetName() == "Font"); - - prop = pgman->GetProperty("Font.Style"); - RT_ASSERT(prop); - parent = prop->GetMainParent(); - RT_ASSERT(parent); - RT_ASSERT(parent->GetName() == "Font"); - - prop = pgman->GetProperty("Car"); - RT_ASSERT(prop); - parent = prop->GetMainParent(); - RT_ASSERT(parent); - RT_ASSERT(parent->GetName() == "Car"); - - prop = pgman->GetProperty("Car.Model"); - RT_ASSERT(prop); - parent = prop->GetMainParent(); - RT_ASSERT(parent); - RT_ASSERT(parent->GetName() == "Car"); - - prop = pgman->GetProperty("Car.Speeds"); - RT_ASSERT(prop); - parent = prop->GetMainParent(); - RT_ASSERT(parent); - RT_ASSERT(parent->GetName() == "Car"); - - prop = pgman->GetProperty("3D Object.Triangle 3.A"); - RT_ASSERT(prop); - parent = prop->GetMainParent(); - RT_ASSERT(parent); - RT_ASSERT(parent->GetName() == "3D Object"); - - prop = pgman->GetProperty("3D Object.Triangle 3.A.Z"); - RT_ASSERT(prop); - parent = prop->GetMainParent(); - RT_ASSERT(parent); - RT_ASSERT(parent->GetName() == "3D Object"); - } - - { - // - // Test label editing - RT_START_TEST(LABEL_EDITING) - - pg = pgman->GetGrid(); - - // Just mostly test that these won't crash - pg->MakeColumnEditable(0, true); - pg->MakeColumnEditable(2, true); - pg->MakeColumnEditable(0, false); - pg->MakeColumnEditable(2, false); - pg->SelectProperty("Height"); - pg->BeginLabelEdit(0); - pg->BeginLabelEdit(0); - pg->EndLabelEdit(0); - pg->EndLabelEdit(0); - - // Recreate grid - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - } - - { - RT_START_TEST(Attributes) - - wxPGProperty* prop = pgman->GetProperty("StringProperty"); - prop->SetAttribute("Dummy Attribute", 15L); - - if ( prop->GetAttribute("Dummy Attribute").GetLong() != 15L ) - RT_FAILURE(); - - prop->SetAttribute("Dummy Attribute", wxVariant()); - - if ( !prop->GetAttribute("Dummy Attribute").IsNull() ) - RT_FAILURE(); - } - - { - RT_START_TEST(Attributes with PGManager) - - const long val = 25; - pgman->SetPropertyAttribute("IntProperty", "Dummy Attribute", val); - if ( pgman->GetPropertyAttribute("IntProperty", "Dummy Attribute").GetLong() != val ) - RT_FAILURE(); - - pgman->SetPropertyAttribute("IntProperty", "Dummy Attribute", wxVariant()); - if ( !pgman->GetPropertyAttribute("IntProperty", "Dummy Attribute").IsNull() ) - RT_FAILURE(); - } - - { - RT_START_TEST(Getting list of attributes) - - wxPGProperty* prop = pgman->GetProperty("Height"); - const wxPGAttributeStorage& attrs1 = prop->GetAttributes(); - if ( attrs1.GetCount() < 1 ) - RT_FAILURE(); - - const wxPGAttributeStorage& attrs2 = pgman->GetPropertyAttributes("Height"); - if ( attrs2.GetCount() != attrs1.GetCount() ) - RT_FAILURE(); - - // Compare both lists - wxVariant val1; - wxVariant val2; - wxPGAttributeStorage::const_iterator it = attrs1.StartIteration(); - while ( attrs1.GetNext(it, val1) ) - { - val2 = attrs2.FindValue(val1.GetName()); - if ( val1 != val2 ) - RT_FAILURE(); - } - } - - { - RT_START_TEST(Copying list of attributes) - - wxPGAttributeStorage attrs1(pgman->GetPropertyAttributes("Height")); - if ( attrs1.GetCount() < 1 ) - RT_FAILURE(); - - wxPGAttributeStorage attrs2; - attrs2 = attrs1; - if ( attrs2.GetCount() != attrs1.GetCount() ) - RT_FAILURE(); - - // Compare both lists - wxVariant val1; - wxVariant val2; - wxPGAttributeStorage::const_iterator it = attrs1.StartIteration(); - while ( attrs1.GetNext(it, val1) ) - { - val2 = attrs2.FindValue(val1.GetName()); - if ( val1 != val2 ) - RT_FAILURE(); - } - } - - { - RT_START_TEST(MaxLength) - - wxPGProperty* prop1 = pgman->GetProperty("StringProperty"); - wxString propSetValStr = "12345678901234567890"; - prop1->SetValueFromString(propSetValStr); - if ( !prop1->SetMaxLength(10) ) - RT_FAILURE(); - if ( prop1->GetMaxLength() != 10 ) - RT_FAILURE(); - wxString propGetValStr = prop1->GetValueAsString(); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - prop1->SetValueFromString(propSetValStr); - propGetValStr = prop1->GetValueAsString(); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - - if ( !prop1->SetMaxLength(-1) ) - RT_FAILURE(); - if ( prop1->GetMaxLength() != 0 ) - RT_FAILURE(); - propGetValStr = prop1->GetValueAsString(); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - - wxPGProperty* prop2 = pgman->GetProperty("LongStringProp"); - propSetValStr = "123456789012345678901234567890"; - prop2->SetValueFromString(propSetValStr); - if ( !prop2->SetMaxLength(20) ) - RT_FAILURE(); - if ( prop2->GetMaxLength() != 20 ) - RT_FAILURE(); - propGetValStr = prop2->GetValueAsString(); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - prop2->SetValueFromString(propSetValStr); - propGetValStr = prop2->GetValueAsString(); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - - wxPGProperty* prop3 = pgman->GetProperty("IntProperty"); - const long propSetValInt = 1234567; - prop3->SetValueFromInt(propSetValInt); - if ( !prop3->SetMaxLength(4) ) - RT_FAILURE(); - if ( prop3->GetMaxLength() != 4 ) - RT_FAILURE(); - int propGetValInt = prop3->GetValue().GetLong(); - if ( propGetValInt != propSetValInt ) - RT_FAILURE(); - prop3->SetValueFromInt(propSetValInt); - propGetValInt = prop3->GetValue().GetLong(); - if ( propGetValInt != propSetValInt ) - RT_FAILURE(); - - wxPGProperty* prop4 = pgman->GetProperty("ArrayStringProperty"); - const wxString arrStr[3] { "01234567890", "abcdefghijk", "ABCDEFGHIJK" }; - wxArrayString propSetValArrStr(WXSIZEOF(arrStr), arrStr); - prop4->SetValue(wxVariant(propSetValArrStr)); - if ( !prop4->SetMaxLength(25) ) - RT_FAILURE(); - if ( prop4->GetMaxLength() != 25 ) - RT_FAILURE(); - wxArrayString propGetValArrStr = prop4->GetValue().GetArrayString(); - if ( propGetValArrStr != propSetValArrStr ) - RT_FAILURE(); - prop4->SetValueFromString(wxVariant(propSetValArrStr)); - propGetValStr = prop4->GetValueAsString(); - if ( propGetValArrStr != propSetValArrStr ) - RT_FAILURE(); - - - wxPGProperty* prop5 = pgman->GetProperty("EnumProperty"); - if ( prop5->SetMaxLength(50) ) - RT_FAILURE(); - - wxPGProperty* prop6 = pgman->GetProperty("BoolProperty"); - if ( prop6->SetMaxLength(60) ) - RT_FAILURE(); - } - - { - RT_START_TEST(MaxLength with PG) - pgman->SelectPage(2); - pg = pgman->GetGrid(); - - wxPGProperty* prop1 = pgman->GetProperty("StringProperty"); - wxString propSetValStr = "12345678901234567890"; - pg->SetPropertyValue(prop1, propSetValStr); - if ( !pg->SetPropertyMaxLength("StringProperty", 15) ) - RT_FAILURE(); - if ( prop1->GetMaxLength() != 15 ) - RT_FAILURE(); - wxString propGetValStr = pg->GetPropertyValueAsString(prop1); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - pg->SetPropertyValue(prop1, propSetValStr); - propGetValStr = pg->GetPropertyValueAsString(prop1); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - - if ( !pg->SetPropertyMaxLength("StringProperty", -1) ) - RT_FAILURE(); - if ( prop1->GetMaxLength() != 0 ) - RT_FAILURE(); - propGetValStr = pg->GetPropertyValueAsString(prop1); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - - wxPGProperty* prop2 = pgman->GetProperty("LongStringProp"); - propSetValStr = "123456789012345678901234567890"; - pg->SetPropertyValue(prop2, propSetValStr); - if ( !pg->SetPropertyMaxLength("LongStringProp", 25) ) - RT_FAILURE(); - if ( prop2->GetMaxLength() != 25 ) - RT_FAILURE(); - propGetValStr = pg->GetPropertyValueAsString(prop2); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - pg->SetPropertyValue(prop2, propSetValStr); - propGetValStr = pg->GetPropertyValueAsString(prop2); - if ( propGetValStr != propSetValStr ) - RT_FAILURE(); - - wxPGProperty* prop3 = pgman->GetProperty("FloatProperty"); - double propSetValFloat = 1234.567; - pg->SetPropertyValue(prop3, propSetValFloat); - if ( !pg->SetPropertyMaxLength("FloatProperty", 5) ) - RT_FAILURE(); - if ( prop3->GetMaxLength() != 5 ) - RT_FAILURE(); - double propGetValFloat = pg->GetPropertyValueAsDouble(prop3); - if ( propGetValFloat != propSetValFloat ) - RT_FAILURE(); - - if ( !pg->SetPropertyMaxLength("FloatProperty", -1) ) - RT_FAILURE(); - if ( prop3->GetMaxLength() != 0 ) - RT_FAILURE(); - propGetValFloat = pg->GetPropertyValueAsDouble(prop3); - if ( propGetValFloat != propSetValFloat ) - RT_FAILURE(); - - if ( pg->SetPropertyMaxLength("ColourProperty", 35) ) - RT_FAILURE(); - - if ( pg->SetPropertyMaxLength("BoolProperty", 3) ) - RT_FAILURE(); - } - -#if WXWIN_COMPATIBILITY_3_0 - { - RT_START_TEST(DoubleToString) - - // Locale-specific decimal separator - wxString sep = wxString::Format("%g", 1.1)[1]; - - wxString s; - - if ( wxPropertyGrid::DoubleToString(s, 123.123, 2, true) != - wxString::Format("123%s12", sep) ) - RT_FAILURE(); - if ( wxPropertyGrid::DoubleToString(s, -123.123, 4, false) != - wxString::Format("-123%s1230", sep) ) - RT_FAILURE(); - if ( wxPropertyGrid::DoubleToString(s, -0.02, 1, false) != - wxString::Format("0%s0", sep) ) - RT_FAILURE(); - if ( wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) != "0" ) - RT_FAILURE(); - } -#endif - - { - wxPropertyGridPage* page1; - wxPropertyGridPage* page2; - wxPropertyGridPage* page3; - wxVariant pg1_values; - wxVariant pg2_values; - wxVariant pg3_values; - - { - RT_START_TEST(GetPropertyValues) - - page1 = pgman->GetPage(0); - pg1_values = page1->GetPropertyValues("Page1",nullptr,wxPG_KEEP_STRUCTURE); - page2 = pgman->GetPage(1); - pg2_values = page2->GetPropertyValues("Page2",nullptr,wxPG_KEEP_STRUCTURE); - page3 = pgman->GetPage(2); - pg3_values = page3->GetPropertyValues("Page3",nullptr,wxPG_KEEP_STRUCTURE); - } - - { - RT_START_TEST(SetPropertyValues) - - page1->SetPropertyValues(pg3_values); - page2->SetPropertyValues(pg1_values); - page3->SetPropertyValues(pg2_values); - } - } - - if ( !pgman->HasFlag(wxPG_HIDE_CATEGORIES) ) - { - RT_START_TEST(Collapse_and_GetFirstCategory_and_GetNextCategory) - - for ( i=0; i<3; i++ ) - { - wxPropertyGridPage* page = pgman->GetPage(i); - - wxPropertyGridIterator it; - - for ( it = page->GetIterator( wxPG_ITERATE_CATEGORIES ); - !it.AtEnd(); - ++it ) - { - wxPGProperty* p = *it; - - if ( !page->IsPropertyCategory(p) ) - RT_FAILURE(); - - page->Collapse( p ); - - t.Printf("Collapsing: %s\n",page->GetPropertyLabel(p)); - ed->AppendText(t); - } - } - } - - { - RT_START_TEST(Save_And_RestoreEditableState) - - for ( i=0; i<3; i++ ) - { - pgman->SelectPage(i); - - wxString stringState = pgman->SaveEditableState(); - bool res = pgman->RestoreEditableState(stringState); - if ( !res ) - RT_FAILURE(); - } - } - - //if ( !pgman->HasFlag(wxPG_HIDE_CATEGORIES) ) - { - RT_START_TEST(Expand_and_GetFirstCategory_and_GetNextCategory) - - for ( i=0; i<3; i++ ) - { - wxPropertyGridPage* page = pgman->GetPage(i); - - wxPropertyGridIterator it; - - for ( it = page->GetIterator( wxPG_ITERATE_CATEGORIES ); - !it.AtEnd(); - ++it ) - { - wxPGProperty* p = *it; - - if ( !page->IsPropertyCategory(p) ) - RT_FAILURE(); - - page->Expand( p ); - - t.Printf("Expand: %s\n",page->GetPropertyLabel(p)); - ed->AppendText(t); - } - } - } - - { - RT_START_TEST(Choice_Manipulation) - - wxPGProperty* enumProp = pgman->GetProperty("EnumProperty"); - - pgman->SelectPage(2); - pgman->SelectProperty(enumProp); - wxASSERT(pgman->GetGrid()->GetSelection() == enumProp); - - const wxPGChoices& choices = enumProp->GetChoices(); - int ind = enumProp->InsertChoice("New Choice", choices.GetCount()/2); - enumProp->DeleteChoice(ind); - - // Recreate the original grid - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - } - - //if ( !pgman->HasFlag(wxPG_HIDE_CATEGORIES) ) - { - RT_START_TEST(RandomCollapse) - - // Select the most error prone page as visible. - pgman->SelectPage(1); - - for ( i=0; i<3; i++ ) - { - wxVector arr; - - wxPropertyGridPage* page = pgman->GetPage(i); - - wxPropertyGridIterator it; - - for ( it = page->GetIterator( wxPG_ITERATE_CATEGORIES ); - !it.AtEnd(); - ++it ) - { - arr.push_back(*it); - } - - if ( !arr.empty() ) - { - pgman->Collapse( arr[0] ); - - for ( size_t n=arr.size()-1; n>0; n-- ) - { - pgman->Collapse( arr[n] ); - } - } - - } - } - - { - RT_START_TEST(EnsureVisible) - pgman->EnsureVisible("Cell Colour"); - } - - { - RT_START_TEST(RemoveProperty) - - wxPGProperty* p; - - wxPGProperty* origParent = - pgman->GetProperty("Window Styles")->GetParent(); - - // For testing purposes, let's set some custom cell colours - p = pgman->GetProperty("Window Styles"); - p->SetCell(2, wxPGCell("style")); - p = pgman->RemoveProperty("Window Styles"); - pgman->Refresh(); - pgman->Update(); - - pgman->AppendIn(origParent, p); - wxASSERT( p->GetCell(2).GetText() == "style"); - pgman->Refresh(); - pgman->Update(); - } - - { - RT_START_TEST(SortFunction) - - wxPGProperty* p; - - // Make sure indexes are as supposed - - p = pgman->GetProperty("User Name"); - if ( p->GetIndexInParent() != 3 ) - RT_FAILURE(); - - p = pgman->GetProperty("User Id"); - if ( p->GetIndexInParent() != 2 ) - RT_FAILURE(); - - p = pgman->GetProperty("User Home"); - if ( p->GetIndexInParent() != 1 ) - RT_FAILURE(); - - p = pgman->GetProperty("Operating System"); - if ( p->GetIndexInParent() != 0 ) - RT_FAILURE(); - - pgman->GetGrid()->SetSortFunction(MyPropertySortFunction); - - pgman->GetGrid()->SortChildren("Environment"); - - // Make sure indexes have been reversed - p = pgman->GetProperty("User Name"); - if ( p->GetIndexInParent() != 0 ) - RT_FAILURE(); - - p = pgman->GetProperty("User Id"); - if ( p->GetIndexInParent() != 1 ) - RT_FAILURE(); - - p = pgman->GetProperty("User Home"); - if ( p->GetIndexInParent() != 2 ) - RT_FAILURE(); - - p = pgman->GetProperty("Operating System"); - if ( p->GetIndexInParent() != 3 ) - RT_FAILURE(); - } - - { - RT_START_TEST(SetPropertyBackgroundColour) - wxCommandEvent evt; - evt.SetInt(1); // IsChecked() will return true. - evt.SetId(ID_COLOURSCHEME4); - OnCatColours(evt); - OnColourScheme(evt); - } - - { - RT_START_TEST(Clear) - - // Manager clear - pgman->SelectProperty("Label"); - pgman->Clear(); - - if ( pgman->GetPageCount() ) - RT_FAILURE(); - - if ( pgman->GetGrid()->GetRoot()->HasAnyChild() ) - RT_FAILURE(); - - // Recreate the original grid - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - - // Grid clear - pgman->SelectProperty("Label"); - pgman->GetGrid()->Clear(); - - if ( pgman->GetGrid()->GetRoot()->HasAnyChild() ) - RT_FAILURE(); - - // Recreate the original grid - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - } - - { - RT_START_TEST(SetSplitterPosition) - - const int trySplitterPos = 50; - - int style = wxPG_AUTO_SORT; // wxPG_SPLITTER_AUTO_CENTER; - ReplaceGrid(style, -1); - pgman = m_pPropGridManager; - - pgman->SetSplitterPosition(trySplitterPos); - - if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos ) - RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos)); - - wxSize origSz = GetSize(); - - wxSize sz = origSz; - sz.IncBy(5, 5); - SetSize(sz); - - if ( pgman->GetGrid()->GetSplitterPosition() != trySplitterPos ) - RT_FAILURE_MSG(wxString::Format("Splitter position was %i (should have been %i)",(int)pgman->GetGrid()->GetSplitterPosition(),trySplitterPos)); - - SetSize(origSz); - - // Recreate the original grid - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - } - - { - RT_START_TEST(HideProperty) - - wxPropertyGridPage* page = pgman->GetPage(0); - - wxVector arr1 = GetPropertiesInRandomOrder(page); - - if ( !_failed_ ) - { - for ( i=0; iHideProperty(p, true); - - wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()); - RT_VALIDATE_VIRTUAL_HEIGHT(page, s) - if ( _failed_ ) - break; - } - } - - if ( !_failed_ ) - { - wxVector arr2 = GetPropertiesInRandomOrder(page); - - for ( i=0; iHideProperty(p, false); - - wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()); - RT_VALIDATE_VIRTUAL_HEIGHT(page, s) - if ( _failed_ ) - break; - } - } - - // - // Let's do some more, for better consistency - arr1 = GetPropertiesInRandomOrder(page); - - if ( !_failed_ ) - { - for ( i=0; iHideProperty(p, true); - - wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()); - RT_VALIDATE_VIRTUAL_HEIGHT(page, s) - if ( _failed_ ) - break; - } - } - - if ( !_failed_ ) - { - wxVector arr2 = GetPropertiesInRandomOrder(page); - - for ( i=0; iHideProperty(p, false); - - wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()); - RT_VALIDATE_VIRTUAL_HEIGHT(page, s) - if ( _failed_ ) - break; - } - } - - // - // Ok, this time only hide half of them - arr1 = GetPropertiesInRandomOrder(page); - arr1.resize(arr1.size()/2); - - if ( !_failed_ ) - { - for ( i=0; iHideProperty(p, true); - - wxString s = wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()); - RT_VALIDATE_VIRTUAL_HEIGHT(page, s) - if ( _failed_ ) - break; - } - } - - if ( !_failed_ ) - { - wxVector arr2 = GetPropertiesInRandomOrder(page); - - for ( i=0; iHideProperty(p, false); - - wxString s = wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()); - RT_VALIDATE_VIRTUAL_HEIGHT(page, s) - if ( _failed_ ) - break; - } - } - - // Recreate the original grid - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - } - - { - RT_START_TEST(SetFlagsAsString and GetFlagsAsString) - - // Select the most error prone page as visible. - pgman->SelectPage(1); - - for ( i = 0; i < 3; i++ ) - { - wxPropertyGridPage* page = pgman->GetPage(i); - - wxPropertyGridIterator it; - for ( it = page->GetIterator(wxPG_ITERATE_VISIBLE); - !it.AtEnd(); - ++it ) - { - wxPGProperty *p = *it; - - // Save initial flags - wxPGProperty::FlagType oldFlags = 0; - if( p->HasFlag(wxPG_PROP_COLLAPSED) ) - { - oldFlags |= wxPG_PROP_COLLAPSED; - } - if( p->HasFlag(wxPG_PROP_DISABLED) ) - { - oldFlags |= wxPG_PROP_DISABLED; - } - if( p->HasFlag(wxPG_PROP_HIDDEN) ) - { - oldFlags |= wxPG_PROP_HIDDEN; - } - if( p->HasFlag(wxPG_PROP_NOEDITOR) ) - { - oldFlags |= wxPG_PROP_NOEDITOR; - } - - wxString flags; - - if ( p->IsCategory() ) - { - if ( GetRandomBooleanVal() ) - { - if ( !flags.empty() ) - { - flags.append("|"); - } - flags.append("COLLAPSED"); - } - } - - if (GetRandomBooleanVal() ) - { - if ( !flags.empty() ) - { - flags.append("|"); - } - flags.append("DISABLED"); - } - - if ( GetRandomBooleanVal() ) - { - if ( !flags.empty() ) - { - flags.append("|"); - } - flags.append("HIDDEN"); - } - - // Set flags - p->SetFlagsFromString(flags); - - // Verify if flags have been properly set - if ( flags.Find("COLLAPSED") != wxNOT_FOUND && - !p->HasFlag(wxPG_PROP_COLLAPSED) ) - { - RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'COLLAPSED' for property '%s'", - p->GetName())); - } - if ( flags.Find("COLLAPSED") == wxNOT_FOUND && - p->HasFlag(wxPG_PROP_COLLAPSED) ) - { - RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'COLLAPSED'for property '%s'", - p->GetName())); - } - if ( flags.Find("DISABLED") != wxNOT_FOUND && - !p->HasFlag(wxPG_PROP_DISABLED) ) - { - RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'DISABLED' for property '%s'", - p->GetName())); - } - if ( flags.Find("DISABLED") == wxNOT_FOUND && - p->HasFlag(wxPG_PROP_DISABLED) ) - { - RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'DISABLED' for property '%s'", - p->GetName())); - } - if ( flags.Find("HIDDEN") != wxNOT_FOUND && - !p->HasFlag(wxPG_PROP_HIDDEN) ) - { - RT_FAILURE_MSG(wxString::Format("Error setting flag from string 'HIDDEN' for property '%s'", - p->GetName())); - } - if ( flags.Find("HIDDEN") == wxNOT_FOUND && - p->HasFlag(wxPG_PROP_HIDDEN) ) - { - RT_FAILURE_MSG(wxString::Format("Error resetting flag from string 'HIDDEN' for property '%s'", - p->GetName())); - } - - // Get individual flags - bool ok; - - flags = p->GetFlagsAsString(wxPG_PROP_COLLAPSED); - if ( p->HasFlag(wxPG_PROP_COLLAPSED) ) - { - ok = (flags == "COLLAPSED"); - } - else - { - ok = flags.empty(); - } - if ( !ok ) - { - RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'", - p->GetName())); - } - - flags = p->GetFlagsAsString(wxPG_PROP_DISABLED); - if ( p->HasFlag(wxPG_PROP_DISABLED) ) - { - ok = (flags == "DISABLED"); - } - else - { - ok = flags.empty(); - } - if ( !ok ) - { - RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_DISABLED flag for property '%s'", - p->GetName())); - } - - flags = p->GetFlagsAsString(wxPG_PROP_HIDDEN); - if ( p->HasFlag(wxPG_PROP_HIDDEN) ) - { - ok = (flags == "HIDDEN"); - } - else - { - ok = flags.empty(); - } - if ( !ok ) - { - RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'", - p->GetName())); - } - - flags = p->GetFlagsAsString(wxPG_PROP_NOEDITOR); - if ( p->HasFlag(wxPG_PROP_NOEDITOR) ) - { - ok = (flags == "NOEDITOR"); - } - else - { - ok = flags.empty(); - } - if ( !ok ) - { - RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'", - p->GetName())); - } - - // Get all flags - flags = p->GetFlagsAsString(wxPG_STRING_STORED_FLAGS); - if ( p->HasFlag(wxPG_PROP_COLLAPSED) ) - { - ok = (flags.Find("COLLAPSED") != wxNOT_FOUND); - } - else - { - ok = (flags.Find("COLLAPSED") == wxNOT_FOUND); - } - if ( !ok ) - { - RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'", - p->GetName())); - } - - if ( p->HasFlag(wxPG_PROP_DISABLED) ) - { - ok = (flags.Find("DISABLED") != wxNOT_FOUND); - } - else - { - ok = (flags.Find("DISABLED") == wxNOT_FOUND); - } - if ( !ok ) - { - RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_DISBALED flag for property '%s'", - p->GetName())); - } - - if ( p->HasFlag(wxPG_PROP_HIDDEN) ) - { - ok = (flags.Find("HIDDEN") != wxNOT_FOUND); - } - else - { - ok = (flags.Find("HIDDEN") == wxNOT_FOUND); - } - if ( !ok ) - { - RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'", - p->GetName())); - } - - if ( p->HasFlag(wxPG_PROP_NOEDITOR) ) - { - ok = (flags.Find("NOEDITOR") != wxNOT_FOUND); - } - else - { - ok = (flags.Find("NOEDITOR") == wxNOT_FOUND); - } - if ( !ok ) - { - RT_FAILURE_MSG(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'", - p->GetName())); - } - - // Restore original flags - p->ChangeFlag(wxPG_PROP_COLLAPSED, (oldFlags & wxPG_PROP_COLLAPSED) != 0); - p->ChangeFlag(wxPG_PROP_DISABLED, (oldFlags & wxPG_PROP_DISABLED) != 0); - p->ChangeFlag(wxPG_PROP_HIDDEN, (oldFlags & wxPG_PROP_HIDDEN) != 0); - p->ChangeFlag(wxPG_PROP_NOEDITOR, (oldFlags & wxPG_PROP_NOEDITOR) != 0); - } - } - } - - if ( fullTest ) - { - RT_START_TEST(MultipleColumns) - - // Test with multiple columns - ReplaceGrid( -1, -1 ); - pgman = m_pPropGridManager; - for ( i=3; i<12; i+=2 ) - { - RT_MSG(wxString::Format("%i columns",(int)i)); - pgman->SetColumnCount(i); - Refresh(); - Update(); - wxMilliSleep(500); - } - } - - if ( fullTest ) - { - RT_START_TEST(WindowStyles) - - // Recreate grid with all possible (single) flags - wxASSERT(wxPG_AUTO_SORT == 0x000000010); - - for ( i=4; i<16; i++ ) - { - int flag = 1<m_warnings); -#endif - RT_MSG(s) - for ( i=0; iClose(); - } - - pgman->SelectPage(0); - - // Test may screw up the toolbar, so we need to refresh it. - wxToolBar* toolBar = pgman->GetToolBar(); - if ( toolBar ) - toolBar->Refresh(); - - return retVal; -} - -// ----------------------------------------------------------------------- diff --git a/tests/Makefile.in b/tests/Makefile.in index ecb27949c0..034acc6bd4 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -226,6 +226,7 @@ TEST_GUI_OBJECTS = \ test_gui_ownerdrawncomboboxtest.o \ test_gui_pickerbasetest.o \ test_gui_pickertest.o \ + test_gui_propgridtest.o \ test_gui_radioboxtest.o \ test_gui_radiobuttontest.o \ test_gui_rearrangelisttest.o \ @@ -360,6 +361,9 @@ COND_MONOLITHIC_0___WXLIB_XRC_p = \ COND_MONOLITHIC_0___WXLIB_HTML_p = \ -lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html-$(WX_RELEASE)$(HOST_SUFFIX) @COND_MONOLITHIC_0@__WXLIB_HTML_p = $(COND_MONOLITHIC_0___WXLIB_HTML_p) +COND_MONOLITHIC_0___WXLIB_PROPGRID_p = \ + -lwx_$(PORTNAME)$(WXUNIVNAME)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid-$(WX_RELEASE)$(HOST_SUFFIX) +@COND_MONOLITHIC_0@__WXLIB_PROPGRID_p = $(COND_MONOLITHIC_0___WXLIB_PROPGRID_p) @COND_USE_GUI_1@__test_allheaders___depname = test_allheaders$(EXEEXT) @COND_PLATFORM_MACOSX_1_USE_GUI_1@__test_allheaders_app_Contents_PkgInfo___depname \ @COND_PLATFORM_MACOSX_1_USE_GUI_1@ = test_allheaders.app/Contents/PkgInfo @@ -484,7 +488,7 @@ test$(EXEEXT): $(TEST_OBJECTS) @COND_SHARED_1_USE_GUI_1@ $(SHARED_LD_MODULE_CXX) $@ $(TEST_DRAWINGPLUGIN_OBJECTS) -L$(LIBDIRNAME) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_CORE_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS) @COND_USE_GUI_1@test_gui$(EXEEXT): $(TEST_GUI_OBJECTS) $(__test_gui___win32rc) -@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_GUI_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_WEBVIEW_p) $(EXTRALIBS_WEBVIEW) $(__WXLIB_STC_p) $(EXTRALIBS_STC) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(EXTRALIBS_MEDIA) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS) +@COND_USE_GUI_1@ $(CXX) -o $@ $(TEST_GUI_OBJECTS) -L$(LIBDIRNAME) $(SAMPLES_RPATH_FLAG) $(LDFLAGS) $(WX_LDFLAGS) $(__WXLIB_WEBVIEW_p) $(EXTRALIBS_WEBVIEW) $(__WXLIB_STC_p) $(EXTRALIBS_STC) $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(EXTRALIBS_MEDIA) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(EXTRALIBS_XML) $(__WXLIB_HTML_p) $(EXTRALIBS_HTML) $(__WXLIB_PROPGRID_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) $(EXTRALIBS_FOR_GUI) $(__LIB_ZLIB_p) $(__LIB_REGEX_p) $(__LIB_EXPAT_p) $(EXTRALIBS_FOR_BASE) $(LIBS) @COND_PLATFORM_MACOSX_1_USE_GUI_1@test_gui.app/Contents/PkgInfo: $(__test_gui___depname) $(top_srcdir)/src/osx/carbon/Info.plist.in $(top_srcdir)/src/osx/carbon/wxmac.icns @COND_PLATFORM_MACOSX_1_USE_GUI_1@ mkdir -p test_gui.app/Contents @@ -1044,6 +1048,9 @@ test_gui_pickerbasetest.o: $(srcdir)/controls/pickerbasetest.cpp $(TEST_GUI_ODEP test_gui_pickertest.o: $(srcdir)/controls/pickertest.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/pickertest.cpp +test_gui_propgridtest.o: $(srcdir)/controls/propgridtest.cpp $(TEST_GUI_ODEP) + $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/propgridtest.cpp + test_gui_radioboxtest.o: $(srcdir)/controls/radioboxtest.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/radioboxtest.cpp diff --git a/tests/controls/propgridtest.cpp b/tests/controls/propgridtest.cpp new file mode 100644 index 0000000000..06dac65138 --- /dev/null +++ b/tests/controls/propgridtest.cpp @@ -0,0 +1,1745 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: tests/controls/propgrid.cpp +// Purpose: wxPropertyGrid unit tests +// Author: Artur Wieczorek, Jaakko Salli +// Created: 2023-01-12 +// Copyright: (c) 2023 wxWidgets development team +/////////////////////////////////////////////////////////////////////////////// + +#include "testprec.h" + +#if wxUSE_PROPGRID + +#include "wx/app.h" +#include "wx/artprov.h" +#include "wx/dcmemory.h" +#if wxUSE_DATEPICKCTRL +#include "wx/datectrl.h" +#endif +#include "wx/stopwatch.h" + +#include "wx/propgrid/propgrid.h" +#include "wx/propgrid/manager.h" +#include "wx/propgrid/advprops.h" + +#include +#include + +// Prepare RNG +static std::random_device s_rd; +static std::default_random_engine s_rng(s_rd()); + +static void PopulateWithStandardItems(wxPropertyGridManager* pgManager) +{ + wxPropertyGridPage* pg = pgManager->GetPage("Standard Items"); + + pg->Append(new wxPropertyCategory("Appearance", wxPG_LABEL)); + + pg->Append(new wxStringProperty("Label", wxPG_LABEL, "PropertyGridTest")); + pg->Append(new wxFontProperty("Font", wxPG_LABEL)); + pg->SetPropertyHelpString("Font", "Editing this will change font used in the property grid."); + + pg->Append(new wxSystemColourProperty("Margin Colour", wxPG_LABEL, pg->GetGrid()->GetMarginColour())); + + pg->Append(new wxSystemColourProperty("Cell Colour", wxPG_LABEL, pg->GetGrid()->GetCellBackgroundColour())); + pg->Append(new wxSystemColourProperty("Cell Text Colour", wxPG_LABEL, pg->GetGrid()->GetCellTextColour())); + pg->Append(new wxSystemColourProperty("Line Colour", wxPG_LABEL, pg->GetGrid()->GetLineColour())); + static const wxString flags_prop_labels[] = { + "wxICONIZE", "wxCAPTION", "wxMINIMIZE_BOX", "wxMAXIMIZE_BOX" + }; + long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX, wxMAXIMIZE_BOX }; + wxPGChoices combinedFlags; + combinedFlags.Add(WXSIZEOF(flags_prop_labels), flags_prop_labels, flags_prop_values); + pg->Append(new wxFlagsProperty("Window Styles", wxPG_LABEL, + combinedFlags, wxTheApp->GetTopWindow()->GetWindowStyle())); + + pg->Append(new wxCursorProperty("Cursor", wxPG_LABEL)); + + pg->Append(new wxPropertyCategory("Position", "PositionCategory")); + pg->SetPropertyHelpString("PositionCategory", "Change in items in this category will cause respective changes in frame."); + + pg->Append(new wxIntProperty("Height", wxPG_LABEL, 480L)); + pg->SetPropertyAttribute("Height", wxPG_ATTR_MIN, 10L); + pg->SetPropertyAttribute("Height", wxPG_ATTR_MAX, 2048L); + pg->SetPropertyAttribute("Height", wxPG_ATTR_UNITS, "Pixels"); + + pg->SetPropertyValueUnspecified("Height"); + pg->SetPropertyAttribute("Height", wxPG_ATTR_HINT, "Enter new height for window"); + + pg->SetPropertyHelpString("Height", "This property uses attributes \"Units\" and \"Hint\"."); + + pg->Append(new wxIntProperty("Width", wxPG_LABEL, 640L)); + pg->SetPropertyAttribute("Width", wxPG_ATTR_MIN, 10L); + pg->SetPropertyAttribute("Width", wxPG_ATTR_MAX, 2048L); + pg->SetPropertyAttribute("Width", wxPG_ATTR_UNITS, "Pixels"); + + pg->SetPropertyValueUnspecified("Width"); + pg->SetPropertyAttribute("Width", wxPG_ATTR_HINT, "Enter new width for window"); + pg->SetPropertyHelpString("Width", "This property uses attributes \"Units\" and \"Hint\"."); + + pg->Append(new wxIntProperty("X", wxPG_LABEL, 10L)); + pg->SetPropertyAttribute("X", wxPG_ATTR_UNITS, "Pixels"); + pg->SetPropertyHelpString("X", "This property uses \"Units\" attribute."); + + pg->Append(new wxIntProperty("Y", wxPG_LABEL, 10L)); + pg->SetPropertyAttribute("Y", wxPG_ATTR_UNITS, "Pixels"); + pg->SetPropertyHelpString("Y", "This property uses \"Units\" attribute."); + + const wxString disabledHelpString = "This property is simply disabled."; + + pg->Append(new wxPropertyCategory("Environment", wxPG_LABEL)); + pg->Append(new wxStringProperty("Operating System", wxPG_LABEL, ::wxGetOsDescription())); + + pg->Append(new wxStringProperty("User Id", wxPG_LABEL, ::wxGetUserId())); + pg->Append(new wxDirProperty("User Home", wxPG_LABEL, ::wxGetUserHome())); + pg->Append(new wxStringProperty("User Name", wxPG_LABEL, ::wxGetUserName())); + + // Disable some of them + pg->DisableProperty("Operating System"); + pg->DisableProperty("User Id"); + pg->DisableProperty("User Name"); + + pg->SetPropertyHelpString("Operating System", disabledHelpString); + pg->SetPropertyHelpString("User Id", disabledHelpString); + pg->SetPropertyHelpString("User Name", disabledHelpString); + + pg->Append(new wxPropertyCategory("More Examples", wxPG_LABEL)); + + pg->Append(new wxLongStringProperty("Information", wxPG_LABEL, + "Editing properties will have immediate effect on this window, " + "and vice versa (at least in most cases, that is)." + )); + pg->SetPropertyHelpString("Information", "This property is read-only."); + + pg->SetPropertyReadOnly("Information", true); + + // Set test information for cells in columns 3 and 4 + // (reserve column 2 for displaying units) + wxBitmap bmp = wxArtProvider::GetBitmap(wxART_FOLDER); + + for ( auto it = pg->GetGrid()->GetIterator(); !it.AtEnd(); ++it ) + { + wxPGProperty* p = *it; + if ( p->IsCategory() ) + continue; + + pg->SetPropertyCell(p, 3, "Cell 3", bmp); + pg->SetPropertyCell(p, 4, "Cell 4", wxBitmapBundle(), *wxWHITE, *wxBLACK); + } +} + +static void PopulateWithExamples(wxPropertyGridManager* pgManager) +{ + wxPropertyGridPage* pg = pgManager->GetPage("Examples"); + wxPGProperty* pid; + wxPGProperty* prop; + + pg->Append(new wxIntProperty("IntProperty", wxPG_LABEL, 12345678L)); + +#if wxUSE_SPINBTN + pg->Append(new wxIntProperty("SpinCtrl", wxPG_LABEL, 0L)); + + pg->SetPropertyEditor("SpinCtrl", wxPGEditor_SpinCtrl); + pg->SetPropertyAttribute("SpinCtrl", wxPG_ATTR_MIN, -2L); + pg->SetPropertyAttribute("SpinCtrl", wxPG_ATTR_MAX, 16384L); + pg->SetPropertyAttribute("SpinCtrl", wxPG_ATTR_SPINCTRL_STEP, 2L); + pg->SetPropertyAttribute("SpinCtrl", wxPG_ATTR_SPINCTRL_MOTION, true); + + pg->SetPropertyHelpString("SpinCtrl", + "This is regular wxIntProperty, which editor has been " + "changed to wxPGEditor_SpinCtrl."); + +#endif + + // Add bool property + pg->Append(new wxBoolProperty("BoolProperty", wxPG_LABEL, false)); + + // Add bool property with check box + pg->Append(new wxBoolProperty("BoolProperty with CheckBox", wxPG_LABEL, false)); + pg->SetPropertyAttribute("BoolProperty with CheckBox", wxPG_BOOL_USE_CHECKBOX, true); + + pg->SetPropertyHelpString("BoolProperty with CheckBox", + "Property attribute wxPG_BOOL_USE_CHECKBOX has been set to true."); + + prop = pg->Append(new wxFloatProperty("FloatProperty", wxPG_LABEL, 1234500.23)); + prop->SetAttribute(wxPG_ATTR_MIN, -100.12); + + pg->Append(new wxLongStringProperty("LongStringProperty", "LongStringProp", + "This is much longer string than the first one. Edit it by clicking the button.")); + + wxArrayString example_array; + example_array.Add("String 1"); + example_array.Add("String 2"); + example_array.Add("String 3"); + pg->Append(new wxArrayStringProperty("ArrayStringProperty", wxPG_LABEL, example_array)); + + prop = new wxFileProperty("FileProperty", "TextFile"); + pg->Append(prop); + + prop->SetAttribute(wxPG_FILE_WILDCARD, "Text Files (*.txt)|*.txt"); + prop->SetAttribute(wxPG_DIALOG_TITLE, "Custom File Dialog Title"); + prop->SetAttribute(wxPG_FILE_SHOW_FULL_PATH, false); + +#ifdef __WXMSW__ + prop->SetAttribute(wxPG_FILE_SHOW_RELATIVE_PATH, "C:\\Windows"); + pg->SetPropertyValue(prop, "C:\\Windows\\System32\\msvcrt71.dll"); +#endif + +#if wxUSE_IMAGE + pg->Append(new wxImageFileProperty("ImageFile", wxPG_LABEL)); +#endif + + pid = pg->Append(new wxColourProperty("ColourProperty", wxPG_LABEL, *wxRED)); + pg->SetPropertyEditor("ColourProperty", wxPGEditor_ComboBox); + pg->GetProperty("ColourProperty")->SetAutoUnspecified(true); + pg->SetPropertyHelpString("ColourProperty", + "wxPropertyGrid::SetPropertyEditor method has been used to change " + "editor of this property to wxPGEditor_ComboBox)"); + + pid = pg->Append(new wxColourProperty("ColourPropertyWithAlpha", + wxPG_LABEL, wxColour(15, 200, 95, 128))); + pg->SetPropertyAttribute("ColourPropertyWithAlpha", wxPG_COLOUR_HAS_ALPHA, true); + pg->SetPropertyHelpString("ColourPropertyWithAlpha", + "Attribute \"HasAlpha\" is set to true for this property."); + + pg->Append(new wxColourProperty("ColourProperty2", wxPG_LABEL, *wxGREEN)); + + static const wxString enum_prop_labels[] = { "One Item", + "Another Item", "One More", "This Is Last" }; + + static long enum_prop_values[] = { 40, 80, 120, 160 }; + + pg->Append(new wxEnumProperty("EnumProperty", wxPG_LABEL, + wxArrayString(WXSIZEOF(enum_prop_labels), enum_prop_labels), + wxArrayInt(enum_prop_values, enum_prop_values + WXSIZEOF(enum_prop_values)), 80)); + + wxPGChoices soc; + + soc.Set(wxArrayString(WXSIZEOF(enum_prop_labels), enum_prop_labels), + wxArrayInt(enum_prop_values, enum_prop_values + WXSIZEOF(enum_prop_values))); + + // add extra items + soc.Add("Look, it continues", 200); + soc.Add("Even More", 240); + soc.Add("And More", 280); + soc.Add(wxString(), 300); + soc.Add("True End of the List", 320); + + soc[1].SetFgCol(*wxRED); + soc[1].SetBgCol(*wxLIGHT_GREY); + soc[2].SetFgCol(*wxGREEN); + soc[2].SetBgCol(*wxLIGHT_GREY); + soc[3].SetFgCol(*wxBLUE); + soc[3].SetBgCol(*wxLIGHT_GREY); + soc[4].SetBitmap(wxArtProvider::GetBitmap(wxART_FOLDER)); + + pg->Append(new wxEnumProperty("EnumProperty 2", wxPG_LABEL, soc, 240)); + pg->GetProperty("EnumProperty 2")->AddChoice("Testing Extra", 360); + + pg->Append(new wxEnumProperty("EnumProperty 3", wxPG_LABEL, soc, 240)); + + pg->GetProperty("EnumProperty 3")->SetAttribute(wxPG_ATTR_HINT, "Dummy Hint"); + + pg->SetPropertyHelpString("EnumProperty 3", "This property uses \"Hint\" attribute."); + + pg->Append(new wxEnumProperty("EnumProperty 4", wxPG_LABEL, soc, 240)); + pg->GetProperty("EnumProperty 4")->AddChoice("4th only", 360); + + pg->SetPropertyHelpString("EnumProperty 4", + "Should have one extra item when compared to EnumProperty 3"); + + pg->Append(new wxEnumProperty("EnumProperty With Bitmap", "EnumProperty 5", soc, 280)); + pg->SetPropertyHelpString("EnumProperty 5", "Should have bitmap in front of the displayed value"); + wxBitmap bmpVal = wxArtProvider::GetBitmap(wxART_REMOVABLE); + pg->SetPropertyImage("EnumProperty 5", bmpVal); + + pg->Append(new wxStringProperty("Password", wxPG_LABEL, "password")); + pg->SetPropertyAttribute("Password", wxPG_STRING_PASSWORD, true); + pg->SetPropertyHelpString("Password", "Has attribute wxPG_STRING_PASSWORD set to true"); + + pg->Append(new wxDirProperty("DirProperty", wxPG_LABEL, ::wxGetUserHome())); + pg->SetPropertyAttribute("DirProperty", wxPG_DIALOG_TITLE, "This is a custom dir dialog title"); + + pg->Append(new wxStringProperty("StringProperty", wxPG_LABEL)); + pg->SetPropertyMaxLength("StringProperty", 6); + pg->SetPropertyHelpString("StringProperty","Max length of this text has been limited to 6."); + + pg->SetPropertyValue("StringProperty", "some text"); + + pg->Append(new wxStringProperty("StringProperty AutoComplete", wxPG_LABEL)); + + wxArrayString autoCompleteStrings; + autoCompleteStrings.Add("One choice"); + autoCompleteStrings.Add("Another choice"); + autoCompleteStrings.Add("Another choice, yeah"); + autoCompleteStrings.Add("Yet another choice"); + autoCompleteStrings.Add("Yet another choice, bear with me"); + pg->SetPropertyAttribute("StringProperty AutoComplete", wxPG_ATTR_AUTOCOMPLETE, autoCompleteStrings); + + pg->SetPropertyHelpString("StringProperty AutoComplete", + "AutoComplete attribute has been set for this property."); + + pg->Append(new wxStringProperty("StringPropertyWithBitmap", wxPG_LABEL, "Test Text")); + wxBitmap myTestBitmap1x(60, 15, 32); + { + wxMemoryDC mdc(myTestBitmap1x); + mdc.SetBackground(*wxWHITE_BRUSH); + mdc.Clear(); + mdc.SetPen(*wxBLACK_PEN); + mdc.SetBrush(*wxWHITE_BRUSH); + mdc.DrawRectangle(0, 0, 60, 15); + mdc.DrawLine(0, 0, 59, 14); + mdc.SetTextForeground(*wxBLACK); + mdc.DrawText("x1", 0, 0); + } + wxBitmap myTestBitmap2x(120, 30, 32); + { + wxMemoryDC mdc(myTestBitmap2x); + mdc.SetBackground(*wxWHITE_BRUSH); + mdc.Clear(); + mdc.SetPen(wxPen(*wxBLUE, 2)); + mdc.SetBrush(*wxWHITE_BRUSH); + mdc.DrawRectangle(0, 0, 120, 30); + mdc.DrawLine(0, 0, 119, 31); + mdc.SetTextForeground(*wxBLUE); + wxFont f = mdc.GetFont(); + f.SetPixelSize(2 * f.GetPixelSize()); + mdc.SetFont(f); + mdc.DrawText("x2", 0, 0); + } + myTestBitmap2x.SetScaleFactor(2); + pg->SetPropertyImage("StringPropertyWithBitmap", wxBitmapBundle::FromBitmaps(myTestBitmap1x, myTestBitmap2x)); + + // this value array would be optional if values matched string indexes + static const wxString flags_prop_labels[] = { + "wxICONIZE", "wxCAPTION", "wxMINIMIZE_BOX", "wxMAXIMIZE_BOX" + }; + long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX, wxMAXIMIZE_BOX }; + wxPGChoices combinedFlags; + combinedFlags.Add(WXSIZEOF(flags_prop_labels), flags_prop_labels, flags_prop_values); + pg->Append(new wxFlagsProperty("FlagsProperty", wxPG_LABEL, + combinedFlags, wxTheApp->GetTopWindow()->GetWindowStyle() ) ); + pg->SetPropertyAttribute("FlagsProperty", wxPG_BOOL_USE_CHECKBOX, true, wxPG_RECURSE); + + wxArrayString tchoices; + tchoices.Add("Cabbage"); + tchoices.Add("Carrot"); + tchoices.Add("Onion"); + tchoices.Add("Potato"); + tchoices.Add("Strawberry"); + + wxArrayString tchoicesValues; + tchoicesValues.Add("Carrot"); + tchoicesValues.Add("Potato"); + + pg->Append(new wxEnumProperty("EnumProperty X", wxPG_LABEL, tchoices)); + + pg->Append(new wxMultiChoiceProperty("MultiChoiceProperty", wxPG_LABEL, tchoices, tchoicesValues)); + pg->SetPropertyAttribute("MultiChoiceProperty", wxPG_ATTR_MULTICHOICE_USERSTRINGMODE, 1); + +#if wxUSE_LONGLONG + pg->Append(new wxUIntProperty("UIntProperty", wxPG_LABEL, wxULongLong(wxULL(0xFEEEFEEEFEEE)))); +#else + pg->Append(new wxUIntProperty("UIntProperty", wxPG_LABEL, 0xFEEEFEEE)); +#endif + pg->SetPropertyAttribute("UIntProperty", wxPG_UINT_PREFIX, wxPG_PREFIX_NONE); + pg->SetPropertyAttribute("UIntProperty", wxPG_UINT_BASE, wxPG_BASE_HEX); + + wxPGChoices eech; + eech.Add("Choice 1"); + eech.Add("Choice 2"); + eech.Add("Choice 3"); + pg->Append(new wxEditEnumProperty("EditEnumProperty", wxPG_LABEL, eech, "Choice not in the list")); + + pg->GetProperty("EditEnumProperty")->SetAttribute(wxPG_ATTR_HINT, "Dummy Hint"); + +#if wxUSE_DATETIME + // + // wxDateTimeProperty + pg->Append(new wxDateProperty("DateProperty", wxPG_LABEL, wxDateTime::Now())); + +#if wxUSE_DATEPICKCTRL + pg->SetPropertyAttribute("DateProperty", wxPG_DATE_PICKER_STYLE, + (long)(wxDP_DROPDOWN | wxDP_SHOWCENTURY | wxDP_ALLOWNONE)); + + pg->SetPropertyHelpString("DateProperty", + "Attribute wxPG_DATE_PICKER_STYLE has been set to (long)" + "(wxDP_DROPDOWN | wxDP_SHOWCENTURY | wxDP_ALLOWNONE)."); +#endif + +#endif + + wxPGProperty* carProp = pg->Append(new wxStringProperty("Car", wxPG_LABEL, "")); + + pg->AppendIn(carProp, new wxStringProperty("Model", wxPG_LABEL, "Lamborghini Diablo SV")); + + pg->AppendIn(carProp, new wxIntProperty("Engine Size (cc)", wxPG_LABEL, 5707L)); + + wxPGProperty* speedsProp = pg->AppendIn(carProp, new wxStringProperty("Speeds", wxPG_LABEL, "")); + + pg->AppendIn(speedsProp, new wxIntProperty("Max. Speed (mph)", wxPG_LABEL, 290L)); + pg->AppendIn(speedsProp, new wxFloatProperty("0-100 mph (sec)", wxPG_LABEL, 3.9)); + pg->AppendIn(speedsProp, new wxFloatProperty("1/4 mile (sec)", wxPG_LABEL, 8.6)); + + // This is how child property can be referred to by name + pg->SetPropertyValue("Car.Speeds.Max. Speed (mph)", 300); + + pg->AppendIn(carProp, new wxIntProperty("Price ($)", wxPG_LABEL, 300000L)); + + pg->AppendIn(carProp, new wxBoolProperty("Convertible", wxPG_LABEL, false)); + + wxPGChoices bc; + bc.Add("Wee", wxArtProvider::GetBitmap(wxART_CDROM, wxART_OTHER, wxSize(16, 16))); + bc.Add("Not so wee", wxArtProvider::GetBitmap(wxART_FLOPPY, wxART_OTHER, wxSize(32, 32))); + bc.Add("Friggin' huge", wxArtProvider::GetBitmap(wxART_HARDDISK, wxART_OTHER, wxSize(64, 64))); + + pg->Append(new wxEnumProperty("Variable Height Bitmaps", wxPG_LABEL, bc, 0)); + + pid = new wxStringProperty("wxWidgets Traits", wxPG_LABEL, ""); + pg->SetPropertyReadOnly(pid); + + pid->AppendChild(new wxStringProperty("Latest Release", wxPG_LABEL, "3.2.1")); + pid->AppendChild(new wxBoolProperty("Win API", wxPG_LABEL, true)); + + pg->Append(pid); + + pg->AppendIn(pid, new wxBoolProperty("QT", wxPG_LABEL, true)); + pg->AppendIn(pid, new wxBoolProperty("Cocoa", wxPG_LABEL, true)); + pg->AppendIn(pid, new wxBoolProperty("Haiku", wxPG_LABEL, false)); + pg->AppendIn(pid, new wxStringProperty("Trunk Version", wxPG_LABEL, wxVERSION_NUM_DOT_STRING)); + pg->AppendIn(pid, new wxBoolProperty("GTK+", wxPG_LABEL, true)); +} + +static wxPropertyGridManager* CreateGrid(int style, int extraStyle) +{ + // This function creates the property grid in tests + + if ( style == -1 ) + style = // default style + wxPG_BOLD_MODIFIED | + wxPG_SPLITTER_AUTO_CENTER | + wxPG_AUTO_SORT | + wxPG_TOOLBAR; + + if ( extraStyle == -1 ) + // default extra style + extraStyle = wxPG_EX_MODE_BUTTONS | + wxPG_EX_MULTIPLE_SELECTION; + + wxPropertyGridManager* pgManager = new wxPropertyGridManager(wxTheApp->GetTopWindow(), wxID_ANY, wxDefaultPosition, wxDefaultSize, style); + pgManager->SetSize(wxTheApp->GetTopWindow()->GetClientSize()); + pgManager->SetExtraStyle(extraStyle); + + // This is the default validation failure behaviour + pgManager->SetValidationFailureBehavior(wxPG_VFB_MARK_CELL | + wxPG_VFB_SHOW_MESSAGEBOX); + + wxPropertyGrid* pg = pgManager->GetGrid(); + // Set somewhat different unspecified value appearance + wxPGCell cell; + cell.SetText("Unspecified"); + cell.SetFgCol(*wxLIGHT_GREY); + pg->SetUnspecifiedValueAppearance(cell); + + // Populate grid + pgManager->AddPage("Standard Items"); + PopulateWithStandardItems(pgManager); + pgManager->AddPage("Examples"); + PopulateWithExamples(pgManager); + + pgManager->Refresh(); + pgManager->Update(); + // Wait for update to be done + wxStopWatch sw; + while ( sw.Time() < 100 ) + { + wxYield(); + } + + return pgManager; +} + +static void ReplaceGrid(std::unique_ptr& pgManager, int style, int extraStyle) +{ + pgManager.reset(); // First destr0y previous instance + pgManager.reset(CreateGrid(style, extraStyle)); + pgManager->SetFocus(); +} + +// Callback for testing property sorting +static int CustomPropertySortFunction(wxPropertyGrid*, wxPGProperty* p1, wxPGProperty* p2) +{ + // Reverse alphabetical order + return p2->GetLabel().CmpNoCase(p1->GetBaseName()); +} + +static std::vector GetPropertiesInRandomOrder(wxPropertyGridInterface* props, int iterationFlags = wxPG_ITERATE_ALL) +{ + std::uniform_int_distribution distrib(0, 10000); + std::vector arr; + + for ( auto it = props->GetIterator(iterationFlags); !it.AtEnd(); ++it ) + { + wxPGProperty* p = *it; + size_t randomNumber = distrib(s_rng); + p->SetClientData(reinterpret_cast(randomNumber)); + arr.push_back(p); + } + + std::sort(arr.begin(), arr.end(), [](wxPGProperty* p1, wxPGProperty* p2) { return ((size_t)p1->GetClientData()) < ((size_t)p2->GetClientData()); }); + return arr; +} + +TEST_CASE("PropertyGridTestCase", "[propgrid]") +{ + wxTheApp->GetTopWindow()->Raise(); +#if defined(__WXGTK__) + // Under wxGTK we need to have two children (at least) because if there + // is one child its paint area is set to fill the whole parent frame. + std::unique_ptr win0(new wxWindow(wxTheApp->GetTopWindow(), wxID_ANY)); +#endif // wxGTK + std::unique_ptr pgManager(CreateGrid(-1, -1)); + + SECTION("GetIterator") + { + // Basic iterator tests + + int count; + + count = 0; + for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_PROPERTIES); !it.AtEnd(); it.Next() ) + { + wxPGProperty* p = it.GetProperty(); + if ( p->IsCategory() ) + FAIL_CHECK(wxString::Format("'%s' is a category (non-private child property expected)", p->GetLabel()).c_str()); + else if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) + FAIL_CHECK(wxString::Format("'%s' is a private child (non-private child property expected)", p->GetLabel()).c_str()); + count++; + } + INFO(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES) -> %i entries", count).c_str()); + + count = 0; + for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_CATEGORIES); !it.AtEnd(); it.Next() ) + { + wxPGProperty* p = it.GetProperty(); + if ( !p->IsCategory() ) + FAIL_CHECK(wxString::Format("'%s' is not a category (only category was expected)", p->GetLabel()).c_str()); + count++; + } + INFO(wxString::Format("GetVIterator(wxPG_ITERATE_CATEGORIES) -> %i entries", count).c_str()); + + count = 0; + for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_PROPERTIES | wxPG_ITERATE_CATEGORIES); !it.AtEnd(); it.Next() ) + { + wxPGProperty* p = it.GetProperty(); + if ( p->GetParent()->HasFlag(wxPG_PROP_AGGREGATE) ) + FAIL_CHECK(wxString::Format("'%s' is a private child (non-private child property or category expected)", p->GetLabel()).c_str()); + count++; + } + INFO(wxString::Format("GetVIterator(wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_CATEGORIES) -> %i entries", count).c_str()); + + count = 0; + for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_VISIBLE); !it.AtEnd(); it.Next() ) + { + wxPGProperty* p = it.GetProperty(); + if ( (p->GetParent() != p->GetGrid()->GetRoot() && !p->GetParent()->IsExpanded()) ) + FAIL_CHECK(wxString::Format("'%s' had collapsed parent (only visible properties expected)", p->GetLabel()).c_str()); + else if ( p->HasFlag(wxPG_PROP_HIDDEN) ) + FAIL_CHECK(wxString::Format("'%s' was hidden (only visible properties expected)", p->GetLabel()).c_str()); + count++; + } + + INFO(wxString::Format("GetVIterator(wxPG_ITERATE_VISIBLE) -> %i entries", count).c_str()); + } + + SECTION("SelectProperty") + { + // Test that setting focus to properties does not crash things + + for ( size_t i = 0; i < pgManager->GetPageCount(); i++ ) + { + wxPropertyGridPage* page = pgManager->GetPage(i); + pgManager->SelectPage(page); + + for ( auto it = page->GetIterator(wxPG_ITERATE_VISIBLE); !it.AtEnd(); ++it ) + { + wxPGProperty* p = *it; + INFO(p->GetLabel().c_str()); + pgManager->GetGrid()->SelectProperty(p, true); + ::wxMilliSleep(150); + wxTheApp->GetTopWindow()->Update(); + } + } + SUCCEED(); + } + + SECTION("DeleteProperty") + { + // Delete everything in reverse order + + std::vector array; + for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_ALL & ~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE))); !it.AtEnd(); it.Next() ) + { + array.push_back(it.GetProperty()); + } + + for ( std::vector::reverse_iterator it2 = array.rbegin(); it2 != array.rend(); ++it2 ) + { + wxPGProperty* p = *it2; + INFO(wxString::Format("Deleting '%s' ('%s')", p->GetLabel(), p->GetName()).c_str()); + pgManager->DeleteProperty(p); + } + + // Check if grid is empty. + auto it = pgManager->GetVIterator(wxPG_ITERATE_ALL & ~(wxPG_IT_CHILDREN(wxPG_PROP_AGGREGATE))); + if ( !it.AtEnd() ) + { + FAIL_CHECK("Not all properties are deleted"); + } + + pgManager->Refresh(); + pgManager->Update(); + // Wait for update to be done + wxStopWatch sw; + while ( sw.Time() < 100 ) + { + wxYield(); + } + } + + SECTION("Default_Values") + { + // Test property default values + + for ( auto it = pgManager->GetVIterator(wxPG_ITERATE_PROPERTIES); !it.AtEnd(); it.Next() ) + { + wxPGProperty* p = it.GetProperty(); + pgManager->SetPropertyValue(p, p->GetDefaultValue()); + } + SUCCEED(); + } + + SECTION("wxVariant_to_wxAny_conversion") + { + // Test wxAny<->wxVariant conversion + + wxPGProperty* prop; + wxAny any; + +#if wxUSE_DATETIME + prop = pgManager->GetProperty("DateProperty"); + wxDateTime testTime = wxDateTime::Now(); + any = testTime; + prop->SetValue(any); + CHECK(prop->GetValue().GetAny().As() == testTime); +#endif + + prop = pgManager->GetProperty("IntProperty"); + int testInt = 25537983; + any = testInt; + prop->SetValue(any); + CHECK(prop->GetValue().GetAny().As() == testInt); +#ifdef wxLongLong_t + CHECK(prop->GetValue().GetAny().As() == testInt); +#endif + + prop = pgManager->GetProperty("StringProperty"); + wxString testString = "asd934jfyn3"; + any = testString; + prop->SetValue(any); + CHECK(prop->GetValue().GetAny().As() == testString); + + // Test with a type generated with IMPLEMENT_VARIANT_OBJECT() + prop = pgManager->GetProperty("ColourProperty"); + wxColour testCol = *wxCYAN; + any = testCol; + prop->SetValue(any); + CHECK(prop->GetValue().GetAny().As() == testCol); + } + + SECTION("GetPropertyValues") + { + for ( size_t i = 0; i < pgManager->GetPageCount(); i++ ) + { + wxPropertyGridPage* page = pgManager->GetPage(i); + + wxVariant values = page->GetPropertyValues(); + + for ( size_t j = 0; j < values.GetCount(); j++ ) + { + wxVariant& v = values[j]; + + INFO(wxString::Format("%i: name=\"%s\" type=\"%s\"\n", (int)j, + v.GetName(), v.GetType()).c_str()); + } + } + SUCCEED(); + } + + SECTION("SetPropertyValue_and_GetPropertyValue") + { + // In this section, mixed up usage of "propname" and "propname" + // in wxPropertyGridInterface functions is intentional. + // Purpose is to test wxPGPropArgCls ctors. + + wxArrayString test_arrstr_1; + test_arrstr_1.Add("Apple"); + test_arrstr_1.Add("Orange"); + test_arrstr_1.Add("Lemon"); + + wxArrayString test_arrstr_2; + test_arrstr_2.Add("Potato"); + test_arrstr_2.Add("Cabbage"); + test_arrstr_2.Add("Cucumber"); + + wxArrayInt test_arrint_1; + test_arrint_1.Add(1); + test_arrint_1.Add(2); + test_arrint_1.Add(3); + + wxArrayInt test_arrint_2; + test_arrint_2.Add(0); + test_arrint_2.Add(1); + test_arrint_2.Add(4); + +#if wxUSE_DATETIME + wxDateTime dt1 = wxDateTime::Now(); + dt1.SetYear(dt1.GetYear() - 1); + + wxDateTime dt2 = wxDateTime::Now(); + dt2.SetYear(dt2.GetYear() - 10); +#endif + + wxColour colWithAlpha(1, 128, 254, 100); + wxString colWithAlphaStr(colWithAlpha.GetAsString(wxC2S_CSS_SYNTAX)); + + pgManager->SetPropertyValue("StringProperty", "Text1"); + pgManager->SetPropertyValue("IntProperty", 1024); + pgManager->SetPropertyValue("FloatProperty", 1024.0000000001); + pgManager->SetPropertyValue("BoolProperty", false); + pgManager->SetPropertyValue("EnumProperty", 120); + pgManager->SetPropertyValue("ArrayStringProperty", test_arrstr_1); + wxColour emptyCol; + pgManager->SetPropertyValue("ColourProperty", emptyCol); + pgManager->SetPropertyValue("ColourProperty", const_cast(static_cast(wxBLACK))); + pgManager->SetPropertyValue("MultiChoiceProperty", test_arrint_1); +#if wxUSE_DATETIME + pgManager->SetPropertyValue("DateProperty", dt1); +#endif + + pgManager->SelectPage(1); + wxPropertyGrid* pg = pgManager->GetGrid(); + + CHECK(pg->GetPropertyValueAsString("StringProperty") == "Text1"); + CHECK(pg->GetPropertyValueAsInt("IntProperty") == 1024); + CHECK(pg->GetPropertyValueAsDouble("FloatProperty") == 1024.0000000001); + CHECK(pg->GetPropertyValueAsBool("BoolProperty") == false); + CHECK(pg->GetPropertyValueAsLong("EnumProperty") == 120); + CHECK(pg->GetPropertyValueAsArrayString("ArrayStringProperty") == test_arrstr_1); + wxColour col; + col << pgManager->GetPropertyValue("ColourProperty"); + CHECK(col == *wxBLACK); + CHECK(pg->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_1); +#if wxUSE_DATETIME + CHECK(pg->GetPropertyValueAsDateTime("DateProperty") == dt1); +#endif + +#if wxUSE_LONGLONG && defined(wxLongLong_t) + pgManager->SetPropertyValue("IntProperty", wxLL(10000000000)); + CHECK(pg->GetPropertyValueAsLongLong("IntProperty") == wxLL(10000000000)); +#else + pgman->SetPropertyValue("IntProperty", 1000000000); + CHECK(pg->GetPropertyValueAsLong("IntProperty") == 1000000000); +#endif + + pg->SetPropertyValue("StringProperty", "Text2"); + pg->SetPropertyValue("IntProperty", 512); + pg->SetPropertyValue("FloatProperty", 512.0); + pg->SetPropertyValue("BoolProperty", true); + pg->SetPropertyValue("EnumProperty", 80); + pg->SetPropertyValue("ArrayStringProperty", test_arrstr_2); + pg->SetPropertyValue("ColourProperty", const_cast(static_cast(wxWHITE))); + pg->SetPropertyValue("MultiChoiceProperty", test_arrint_2); +#if wxUSE_DATETIME + pg->SetPropertyValue("DateProperty", dt2); +#endif + + pgManager->SelectPage(0); + + CHECK(pgManager->GetPropertyValueAsString("StringProperty") == "Text2"); + CHECK(pgManager->GetPropertyValueAsInt("IntProperty") == 512); + CHECK(pgManager->GetPropertyValueAsDouble("FloatProperty") == 512.0); + CHECK(pgManager->GetPropertyValueAsBool("BoolProperty") == true); + CHECK(pgManager->GetPropertyValueAsLong("EnumProperty") == 80); + CHECK(pgManager->GetPropertyValueAsArrayString("ArrayStringProperty") == test_arrstr_2); + col << pgManager->GetPropertyValue("ColourProperty"); + CHECK(col == *wxWHITE); + CHECK(pgManager->GetPropertyValueAsArrayInt("MultiChoiceProperty") == test_arrint_2); +#if wxUSE_DATETIME + CHECK(pgManager->GetPropertyValueAsDateTime("DateProperty") == dt2); +#endif + +#if wxUSE_LONGLONG && defined(wxLongLong_t) + pgManager->SetPropertyValue("IntProperty", wxLL(-80000000000)); + CHECK(pgManager->GetPropertyValueAsLongLong("IntProperty") == wxLL(-80000000000)); +#else + pgManager->SetPropertyValue("IntProperty", -1000000000); + CHECK(pgManager->GetPropertyValueAsLong("IntProperty") == -1000000000); +#endif + + wxString nvs = "Lamborghini Diablo XYZ; 5707; [100; 3.9; 8.6] 3000002; Convertible"; + pgManager->SetPropertyValue("Car", nvs); + + CHECK(pgManager->GetPropertyValueAsString("Car.Model") == "Lamborghini Diablo XYZ"); + CHECK(pgManager->GetPropertyValueAsInt("Car.Speeds.Max. Speed (mph)") == 100); + CHECK(pgManager->GetPropertyValueAsInt("Car.Price ($)") == 3000002); + CHECK(pgManager->GetPropertyValueAsBool("Car.Convertible") == true); + + // SetPropertyValueString for special cases such as wxColour + pgManager->SetPropertyValueString("ColourProperty", "(123,4,255)"); + col << pgManager->GetPropertyValue("ColourProperty"); + CHECK(col == wxColour(123, 4, 255)); + pgManager->SetPropertyValueString("ColourProperty", "#FE860B"); + col << pgManager->GetPropertyValue("ColourProperty"); + CHECK(col == wxColour(254, 134, 11)); + + pgManager->SetPropertyValueString("ColourPropertyWithAlpha", "(10, 20, 30, 128)"); + col << pgManager->GetPropertyValue("ColourPropertyWithAlpha"); + CHECK(col == wxColour(10, 20, 30, 128)); + CHECK(pgManager->GetPropertyValueAsString("ColourPropertyWithAlpha") == "(10,20,30,128)"); + } + + SECTION("SetPropertyValueUnspecified") + { + // Null variant setter tests + pgManager->SetPropertyValueUnspecified("StringProperty"); + pgManager->SetPropertyValueUnspecified("IntProperty"); + pgManager->SetPropertyValueUnspecified("FloatProperty"); + pgManager->SetPropertyValueUnspecified("BoolProperty"); + pgManager->SetPropertyValueUnspecified("EnumProperty"); + pgManager->SetPropertyValueUnspecified("ArrayStringProperty"); + pgManager->SetPropertyValueUnspecified("ColourProperty"); + pgManager->SetPropertyValueUnspecified("MultiChoiceProperty"); +#if wxUSE_DATETIME + pgManager->SetPropertyValueUnspecified("DateProperty"); +#endif + SUCCEED(); + } + + SECTION("Multiple_selection") + { + // Test multiple selection + if ( !(pgManager->GetExtraStyle() & wxPG_EX_MULTIPLE_SELECTION) ) + ReplaceGrid(pgManager, -1, wxPG_EX_MULTIPLE_SELECTION); + + wxPropertyGrid* pg = pgManager->GetGrid(); + + wxPGProperty* prop1 = pg->GetProperty("Label"); + wxPGProperty* prop2 = pg->GetProperty("Cell Text Colour"); + wxPGProperty* prop3 = pg->GetProperty("Height"); + wxPGProperty* catProp = pg->GetProperty("Appearance"); + + REQUIRE(prop1); + REQUIRE(prop2); + REQUIRE(prop3); + + pg->ClearSelection(); + pg->AddToSelection(prop1); + pg->AddToSelection(prop2); + pg->AddToSelection(prop3); + + // Adding category to selection should fail silently + pg->AddToSelection(catProp); + + wxArrayPGProperty selectedProperties = pg->GetSelectedProperties(); + + CHECK(selectedProperties.size() == 3); + CHECK(pg->IsPropertySelected(prop1)); + CHECK(pg->IsPropertySelected(prop2)); + CHECK(pg->IsPropertySelected(prop3)); + CHECK_FALSE(pg->IsPropertySelected(catProp)); + + pg->RemoveFromSelection(prop1); + wxArrayPGProperty selectedProperties2 = pg->GetSelectedProperties(); + + CHECK(selectedProperties2.size() == 2); + CHECK_FALSE(pg->IsPropertySelected(prop1)); + CHECK(pg->IsPropertySelected(prop2)); + CHECK(pg->IsPropertySelected(prop3)); + + pg->ClearSelection(); + + wxArrayPGProperty selectedProperties3 = pg->GetSelectedProperties(); + + CHECK(selectedProperties3.size() == 0); + CHECK_FALSE(pg->IsPropertySelected(prop1)); + CHECK_FALSE(pg->IsPropertySelected(prop2)); + CHECK_FALSE(pg->IsPropertySelected(prop3)); + + pg->SelectProperty(prop2); + + CHECK_FALSE(pg->IsPropertySelected(prop1)); + CHECK(pg->IsPropertySelected(prop2)); + CHECK_FALSE(pg->IsPropertySelected(prop3)); + } + + SECTION("GetMainParent") + { + // Test retrieving main parent of the property + + // Simple properties + wxPGProperty* prop = pgManager->GetProperty("DateProperty"); + wxPGProperty* parent = prop->GetMainParent(); + CHECK(parent->GetName() == "DateProperty"); + + prop = pgManager->GetProperty("Label"); + parent = prop->GetMainParent(); + CHECK(parent->GetName() == "Label"); + + // Properties with children + prop = pgManager->GetProperty("Font"); + REQUIRE(prop); + parent = prop->GetMainParent(); + REQUIRE(parent); + CHECK(parent->GetName() == "Font"); + + prop = pgManager->GetProperty("Font.Style"); + REQUIRE(prop); + parent = prop->GetMainParent(); + REQUIRE(parent); + CHECK(parent->GetName() == "Font"); + + prop = pgManager->GetProperty("Car"); + REQUIRE(prop); + parent = prop->GetMainParent(); + REQUIRE(parent); + CHECK(parent->GetName() == "Car"); + + prop = pgManager->GetProperty("Car.Model"); + REQUIRE(prop); + parent = prop->GetMainParent(); + REQUIRE(parent); + CHECK(parent->GetName() == "Car"); + + prop = pgManager->GetProperty("Car.Speeds"); + REQUIRE(prop); + parent = prop->GetMainParent(); + REQUIRE(parent); + CHECK(parent->GetName() == "Car"); + } + + SECTION("Label_editing") + { + // Test label editing + + wxPropertyGrid* pg = pgManager->GetGrid(); + + // Just mostly test that these won't crash + pg->MakeColumnEditable(0, true); + pg->MakeColumnEditable(2, true); + pg->MakeColumnEditable(0, false); + pg->MakeColumnEditable(2, false); + pg->SelectProperty("Height"); + pg->BeginLabelEdit(0); + pg->BeginLabelEdit(0); + pg->EndLabelEdit(0); + pg->EndLabelEdit(0); + SUCCEED(); + } + + SECTION("Attributes") + { + wxPGProperty* prop = pgManager->GetProperty("StringProperty"); + prop->SetAttribute("Dummy Attribute", 15L); + + CHECK(prop->GetAttribute("Dummy Attribute").GetLong() == 15L); + + prop->SetAttribute("Dummy Attribute", wxVariant()); + + CHECK(prop->GetAttribute("Dummy Attribute").IsNull()); + } + + SECTION("Attributes_with_PGManager") + { + const long val = 25; + pgManager->SetPropertyAttribute("IntProperty", "Dummy Attribute", val); + CHECK(pgManager->GetPropertyAttribute("IntProperty", "Dummy Attribute").GetLong() == val); + + pgManager->SetPropertyAttribute("IntProperty", "Dummy Attribute", wxVariant()); + CHECK(pgManager->GetPropertyAttribute("IntProperty", "Dummy Attribute").IsNull()); + } + + SECTION("Getting_list_of_attributes") + { + wxPGProperty* prop = pgManager->GetProperty("Height"); + const wxPGAttributeStorage& attrs1 = prop->GetAttributes(); + CHECK(attrs1.GetCount() >= 1); + + const wxPGAttributeStorage& attrs2 = pgManager->GetPropertyAttributes("Height"); + CHECK(attrs2.GetCount() == attrs1.GetCount()); + + // Compare both lists + wxVariant val1; + wxVariant val2; + wxPGAttributeStorage::const_iterator it = attrs1.StartIteration(); + while ( attrs1.GetNext(it, val1) ) + { + val2 = attrs2.FindValue(val1.GetName()); + CHECK(val1 == val2); + } + } + + SECTION("Copying_list_of_attributes") + { + wxPGAttributeStorage attrs1(pgManager->GetPropertyAttributes("Height")); + CHECK(attrs1.GetCount() >= 1); + + wxPGAttributeStorage attrs2; + attrs2 = attrs1; + CHECK(attrs2.GetCount() == attrs1.GetCount()); + + // Compare both lists + wxVariant val1; + wxVariant val2; + wxPGAttributeStorage::const_iterator it = attrs1.StartIteration(); + while ( attrs1.GetNext(it, val1) ) + { + val2 = attrs2.FindValue(val1.GetName()); + CHECK(val1 == val2); + } + } + + SECTION("MaxLength") + { + wxPGProperty* prop1 = pgManager->GetProperty("StringProperty"); + wxString propSetValStr = "12345678901234567890"; + prop1->SetValueFromString(propSetValStr); + CHECK(prop1->SetMaxLength(10)); + CHECK(prop1->GetMaxLength() == 10); + wxString propGetValStr = prop1->GetValueAsString(); + CHECK(propGetValStr == propSetValStr); + prop1->SetValueFromString(propSetValStr); + propGetValStr = prop1->GetValueAsString(); + CHECK(propGetValStr == propSetValStr); + + CHECK(prop1->SetMaxLength(-1)); + CHECK(prop1->GetMaxLength() == 0); + propGetValStr = prop1->GetValueAsString(); + CHECK(propGetValStr == propSetValStr); + + wxPGProperty* prop2 = pgManager->GetProperty("LongStringProp"); + propSetValStr = "123456789012345678901234567890"; + prop2->SetValueFromString(propSetValStr); + CHECK(prop2->SetMaxLength(20)); + CHECK(prop2->GetMaxLength() == 20); + propGetValStr = prop2->GetValueAsString(); + CHECK(propGetValStr == propSetValStr); + prop2->SetValueFromString(propSetValStr); + propGetValStr = prop2->GetValueAsString(); + CHECK(propGetValStr == propSetValStr); + + wxPGProperty* prop3 = pgManager->GetProperty("IntProperty"); + const long propSetValInt = 1234567; + prop3->SetValueFromInt(propSetValInt); + CHECK(prop3->SetMaxLength(4)); + CHECK(prop3->GetMaxLength() == 4); + int propGetValInt = prop3->GetValue().GetLong(); + CHECK(propGetValInt == propSetValInt); + prop3->SetValueFromInt(propSetValInt); + propGetValInt = prop3->GetValue().GetLong(); + CHECK(propGetValInt == propSetValInt); + + wxPGProperty* prop4 = pgManager->GetProperty("ArrayStringProperty"); + const wxString arrStr[3]{ "01234567890", "abcdefghijk", "ABCDEFGHIJK" }; + wxArrayString propSetValArrStr(WXSIZEOF(arrStr), arrStr); + prop4->SetValue(wxVariant(propSetValArrStr)); + CHECK(prop4->SetMaxLength(25)); + CHECK(prop4->GetMaxLength() == 25); + wxArrayString propGetValArrStr = prop4->GetValue().GetArrayString(); + CHECK(propGetValArrStr == propSetValArrStr); + prop4->SetValueFromString(wxVariant(propSetValArrStr)); + propGetValStr = prop4->GetValueAsString(); + CHECK(propGetValArrStr == propSetValArrStr); + + wxPGProperty* prop5 = pgManager->GetProperty("EnumProperty"); + CHECK_FALSE(prop5->SetMaxLength(50)); + + wxPGProperty* prop6 = pgManager->GetProperty("BoolProperty"); + CHECK_FALSE(prop6->SetMaxLength(60)); + } + + SECTION("MaxLength_with_PG") + { + pgManager->SelectPage(1); + wxPropertyGrid* pg = pgManager->GetGrid(); + + wxPGProperty* prop1 = pgManager->GetProperty("StringProperty"); + wxString propSetValStr = "12345678901234567890"; + pg->SetPropertyValue(prop1, propSetValStr); + CHECK(pg->SetPropertyMaxLength("StringProperty", 15)); + CHECK(prop1->GetMaxLength() == 15); + wxString propGetValStr = pg->GetPropertyValueAsString(prop1); + CHECK(propGetValStr == propSetValStr); + pg->SetPropertyValue(prop1, propSetValStr); + propGetValStr = pg->GetPropertyValueAsString(prop1); + CHECK(propGetValStr == propSetValStr); + + CHECK(pg->SetPropertyMaxLength("StringProperty", -1)); + CHECK(prop1->GetMaxLength() == 0); + propGetValStr = pg->GetPropertyValueAsString(prop1); + CHECK(propGetValStr == propSetValStr); + + wxPGProperty* prop2 = pgManager->GetProperty("LongStringProp"); + propSetValStr = "123456789012345678901234567890"; + pg->SetPropertyValue(prop2, propSetValStr); + CHECK(pg->SetPropertyMaxLength("LongStringProp", 25)); + CHECK(prop2->GetMaxLength() == 25); + propGetValStr = pg->GetPropertyValueAsString(prop2); + CHECK(propGetValStr == propSetValStr); + pg->SetPropertyValue(prop2, propSetValStr); + propGetValStr = pg->GetPropertyValueAsString(prop2); + CHECK(propGetValStr == propSetValStr); + + wxPGProperty* prop3 = pgManager->GetProperty("FloatProperty"); + double propSetValFloat = 1234.567; + pg->SetPropertyValue(prop3, propSetValFloat); + CHECK(pg->SetPropertyMaxLength("FloatProperty", 5)); + CHECK(prop3->GetMaxLength() == 5); + double propGetValFloat = pg->GetPropertyValueAsDouble(prop3); + CHECK(propGetValFloat == propSetValFloat); + + CHECK(pg->SetPropertyMaxLength("FloatProperty", -1)); + CHECK(prop3->GetMaxLength() == 0); + propGetValFloat = pg->GetPropertyValueAsDouble(prop3); + CHECK(propGetValFloat == propSetValFloat); + + CHECK_FALSE(pg->SetPropertyMaxLength("ColourProperty", 35)); + + CHECK_FALSE(pg->SetPropertyMaxLength("BoolProperty", 3)); + } + +#if WXWIN_COMPATIBILITY_3_0 + SECTION("DoubleToString") + { + // Locale-specific decimal separator + wxString sep = wxString::Format("%g", 1.1)[1]; + + wxString s; + + CHECK(wxPropertyGrid::DoubleToString(s, 123.123, 2, true) == + wxString::Format("123%s12", sep)); + CHECK(wxPropertyGrid::DoubleToString(s, -123.123, 4, false) == + wxString::Format("-123%s1230", sep)); + CHECK(wxPropertyGrid::DoubleToString(s, -0.02, 1, false) == + wxString::Format("0%s0", sep)); + CHECK(wxPropertyGrid::DoubleToString(s, -0.000123, 3, true) == "0"); + } +#endif + + SECTION("GetPropertyValues") + { + wxPropertyGridPage* page1 = pgManager->GetPage(0); + wxVariant pg1_values = page1->GetPropertyValues("Page1", nullptr, wxPG_KEEP_STRUCTURE); + wxPropertyGridPage* page2 = pgManager->GetPage(1); + wxVariant pg2_values = page2->GetPropertyValues("Page2", nullptr, wxPG_KEEP_STRUCTURE); + SUCCEED(); + + SECTION("SetPropertyValues") + { + page1->SetPropertyValues(pg2_values); + page2->SetPropertyValues(pg1_values); + SUCCEED(); + } + } + + SECTION("Collapse_and_GetFirstCategory_and_GetNextCategory") + { + for ( size_t i = 0; i < pgManager->GetPageCount(); i++ ) + { + wxPropertyGridPage* page = pgManager->GetPage(i); + + for ( auto it = page->GetIterator(wxPG_ITERATE_CATEGORIES); !it.AtEnd(); ++it ) + { + wxPGProperty* p = *it; + + CHECK(page->IsPropertyCategory(p)); + + INFO(wxString::Format("Collapsing: %s\n", page->GetPropertyLabel(p)).c_str()); + page->Collapse(p); + } + } + } + + SECTION("Save_And_RestoreEditableState") + { + for ( size_t i = 0; i < pgManager->GetPageCount(); i++ ) + { + pgManager->SelectPage(i); + + wxString stringState = pgManager->SaveEditableState(); + CHECK(pgManager->RestoreEditableState(stringState)); + } + } + + SECTION("Expand_and_GetFirstCategory_and_GetNextCategory") + { + for ( size_t i = 0; i < pgManager->GetPageCount(); i++ ) + { + wxPropertyGridPage* page = pgManager->GetPage(i); + + for ( auto it = page->GetIterator(wxPG_ITERATE_CATEGORIES); !it.AtEnd(); ++it ) + { + wxPGProperty* p = *it; + + CHECK(page->IsPropertyCategory(p)); + + INFO(wxString::Format("Expand: %s\n", page->GetPropertyLabel(p)).c_str()); + page->Expand(p); + } + } + } + + SECTION("Choice_Manipulation") + { + wxPGProperty* enumProp = pgManager->GetProperty("EnumProperty"); + + pgManager->SelectPage(1); + pgManager->SelectProperty(enumProp); + REQUIRE(pgManager->GetGrid()->GetSelection() == enumProp); + + const wxPGChoices& choices = enumProp->GetChoices(); + int ind = enumProp->InsertChoice("New Choice", choices.GetCount() / 2); + enumProp->DeleteChoice(ind); + SUCCEED(); + } + + //if ( !pgman->HasFlag(wxPG_HIDE_CATEGORIES) ) + SECTION("RandomCollapse") + { + // Select the most error prone page as visible. + pgManager->SelectPage(1); + + for ( size_t i = 0; i < pgManager->GetPageCount(); i++ ) + { + wxPropertyGridPage* page = pgManager->GetPage(i); + + std::vector arr; + for ( auto it = page->GetIterator(wxPG_ITERATE_CATEGORIES); !it.AtEnd(); ++it ) + { + arr.push_back(*it); + } + + if ( !arr.empty() ) + { + pgManager->Collapse(arr[0]); + + for ( size_t n = arr.size() - 1; n > 0; n-- ) + { + pgManager->Collapse(arr[n]); + } + } + } + SUCCEED(); + } + + SECTION("EnsureVisible") + { + pgManager->EnsureVisible("Cell Colour"); + SUCCEED(); + } + + SECTION("RemoveProperty") + { + wxPGProperty* p; + + wxPGProperty* origParent = pgManager->GetProperty("Window Styles")->GetParent(); + + // For testing purposes, let's set some custom cell colours + p = pgManager->GetProperty("Window Styles"); + p->SetCell(2, wxPGCell("style")); + p = pgManager->RemoveProperty("Window Styles"); + pgManager->Refresh(); + pgManager->Update(); + + pgManager->AppendIn(origParent, p); + CHECK(p->GetCell(2).GetText() == "style"); + pgManager->Refresh(); + pgManager->Update(); + } + + SECTION("SortFunction") + { + wxPGProperty* p; + + // Make sure indexes are as supposed + p = pgManager->GetProperty("User Name"); + CHECK(p->GetIndexInParent() == 3); + + p = pgManager->GetProperty("User Id"); + CHECK(p->GetIndexInParent() == 2); + + p = pgManager->GetProperty("User Home"); + CHECK(p->GetIndexInParent() == 1); + + p = pgManager->GetProperty("Operating System"); + CHECK(p->GetIndexInParent() == 0); + + pgManager->GetGrid()->SetSortFunction(CustomPropertySortFunction); + + pgManager->GetGrid()->SortChildren("Environment"); + + // Make sure indexes have been reversed + p = pgManager->GetProperty("User Name"); + CHECK(p->GetIndexInParent() == 0); + + p = pgManager->GetProperty("User Id"); + CHECK(p->GetIndexInParent() == 1); + + p = pgManager->GetProperty("User Home"); + CHECK(p->GetIndexInParent() == 2); + + p = pgManager->GetProperty("Operating System"); + CHECK(p->GetIndexInParent() == 3); + } + + SECTION("Clear_with_PGManager") + { + // Manager clear + pgManager->SelectProperty("Label"); + pgManager->Clear(); + + CHECK(pgManager->GetPageCount() == 0); + + CHECK_FALSE(pgManager->GetGrid()->GetRoot()->HasAnyChild()); + } + + SECTION("Clear_with_PG") + { + // Grid clear + pgManager->SelectProperty("Label"); + pgManager->GetGrid()->Clear(); + + CHECK_FALSE(pgManager->GetGrid()->GetRoot()->HasAnyChild()); + } + + SECTION("SetPropertyBackgroundColour") + { + wxPropertyGrid* pg = pgManager->GetGrid(); + REQUIRE(pg->GetPropertyByName("Appearance")); + REQUIRE(pg->GetPropertyByName("PositionCategory")); + REQUIRE(pg->GetPropertyByName("Environment")); + REQUIRE(pg->GetPropertyByName("More Examples")); + + pgManager->Freeze(); + // Set custom colours. + pg->SetPropertyTextColour("Appearance", wxColour(255, 0, 0), wxPG_DONT_RECURSE); + pg->SetPropertyBackgroundColour("Appearance", wxColour(255, 255, 183)); + pg->SetPropertyTextColour("Appearance", wxColour(255, 0, 183)); + pg->SetPropertyTextColour("PositionCategory", wxColour(0, 255, 0), wxPG_DONT_RECURSE); + pg->SetPropertyBackgroundColour("PositionCategory", wxColour(255, 226, 190)); + pg->SetPropertyTextColour("PositionCategory", wxColour(255, 0, 190)); + pg->SetPropertyTextColour("Environment", wxColour(0, 0, 255), wxPG_DONT_RECURSE); + pg->SetPropertyBackgroundColour("Environment", wxColour(208, 240, 175)); + pg->SetPropertyTextColour("Environment", wxColour(255, 255, 255)); + pg->SetPropertyBackgroundColour("More Examples", wxColour(172, 237, 255)); + pg->SetPropertyTextColour("More Examples", wxColour(172, 0, 255)); + pgManager->Thaw(); + pgManager->Refresh(); + + wxColour my_grey_1(212, 208, 200); + wxColour my_grey_2(241, 239, 226); + wxColour my_grey_3(113, 111, 100); + pgManager->Freeze(); + pgManager->GetGrid()->SetMarginColour(*wxWHITE); + pgManager->GetGrid()->SetCaptionBackgroundColour(*wxWHITE); + pgManager->GetGrid()->SetCellBackgroundColour(my_grey_2); + pgManager->GetGrid()->SetCellBackgroundColour(my_grey_2); + pgManager->GetGrid()->SetCellTextColour(my_grey_3); + pgManager->GetGrid()->SetLineColour(my_grey_1); + pgManager->Thaw(); + SUCCEED(); + } + + SECTION("SetSplitterPosition") + { + const int trySplitterPos = 50; + + int style = wxPG_AUTO_SORT; // wxPG_SPLITTER_AUTO_CENTER; + ReplaceGrid(pgManager, style, -1); + + pgManager->SetSplitterPosition(trySplitterPos); + + CHECK(pgManager->GetGrid()->GetSplitterPosition() == trySplitterPos); + + wxSize origSz = wxTheApp->GetTopWindow()->GetSize(); + + wxSize sz = origSz; + sz.IncBy(5, 5); + wxTheApp->GetTopWindow()->SetSize(sz); + + CHECK(pgManager->GetGrid()->GetSplitterPosition() == trySplitterPos); + + wxTheApp->GetTopWindow()->SetSize(origSz); + } + + SECTION("HideProperty") + { + wxPropertyGridPage* page = pgManager->GetPage(0); + + std::vector arr1 = GetPropertiesInRandomOrder(page); + for ( size_t i = 0; i < arr1.size(); i++ ) + { + wxPGProperty* p = arr1[i]; + page->HideProperty(p, true); + + INFO(wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()).c_str()); + unsigned int h1 = page->GetVirtualHeight(); + unsigned int h2 = page->GetActualVirtualHeight(); + REQUIRE(h1 == h2); + } + + std::vector arr2 = GetPropertiesInRandomOrder(page); + for ( size_t i = 0; i < arr2.size(); i++ ) + { + wxPGProperty* p = arr2[i]; + page->HideProperty(p, false); + + INFO(wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()).c_str()); + unsigned int h1 = page->GetVirtualHeight(); + unsigned int h2 = page->GetActualVirtualHeight(); + REQUIRE(h1 == h2); + } + + // + // Let's do some more, for better consistency + arr1 = GetPropertiesInRandomOrder(page); + for ( size_t i = 0; i < arr1.size(); i++ ) + { + wxPGProperty* p = arr1[i]; + page->HideProperty(p, true); + + INFO(wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()).c_str()); + unsigned int h1 = page->GetVirtualHeight(); + unsigned int h2 = page->GetActualVirtualHeight(); + REQUIRE(h1 == h2); + } + + arr2 = GetPropertiesInRandomOrder(page); + for ( size_t i = 0; i < arr2.size(); i++ ) + { + wxPGProperty* p = arr2[i]; + page->HideProperty(p, false); + + INFO(wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()).c_str()); + unsigned int h1 = page->GetVirtualHeight(); + unsigned int h2 = page->GetActualVirtualHeight(); + REQUIRE(h1 == h2); + } + + // Ok, this time only hide half of them + arr1 = GetPropertiesInRandomOrder(page); + arr1.resize(arr1.size() / 2); + for ( size_t i = 0; i < arr1.size(); i++ ) + { + wxPGProperty* p = arr1[i]; + page->HideProperty(p, true); + + INFO(wxString::Format("HideProperty(%i, %s)", (int)i, p->GetLabel()).c_str()); + unsigned int h1 = page->GetVirtualHeight(); + unsigned int h2 = page->GetActualVirtualHeight(); + REQUIRE(h1 == h2); + } + + arr2 = GetPropertiesInRandomOrder(page); + for ( size_t i = 0; i < arr2.size(); i++ ) + { + wxPGProperty* p = arr2[i]; + page->HideProperty(p, false); + + INFO(wxString::Format("ShowProperty(%i, %s)", (int)i, p->GetLabel()).c_str()); + unsigned int h1 = page->GetVirtualHeight(); + unsigned int h2 = page->GetActualVirtualHeight(); + REQUIRE(h1 == h2); + } + } + + SECTION("SetFlagsAsString_GetFlagsAsString") + { + std::uniform_int_distribution distrib(0, 1); + + // Select the most error prone page as visible. + pgManager->SelectPage(1); + + for ( size_t i = 0; i < pgManager->GetPageCount(); i++ ) + { + wxPropertyGridPage* page = pgManager->GetPage(i); + + for ( auto it = page->GetIterator(wxPG_ITERATE_VISIBLE); !it.AtEnd(); ++it ) + { + wxPGProperty* p = *it; + + // Save initial flags + wxPGProperty::FlagType oldFlags = 0; + if ( p->HasFlag(wxPG_PROP_COLLAPSED) ) + { + oldFlags |= wxPG_PROP_COLLAPSED; + } + if ( p->HasFlag(wxPG_PROP_DISABLED) ) + { + oldFlags |= wxPG_PROP_DISABLED; + } + if ( p->HasFlag(wxPG_PROP_HIDDEN) ) + { + oldFlags |= wxPG_PROP_HIDDEN; + } + if ( p->HasFlag(wxPG_PROP_NOEDITOR) ) + { + oldFlags |= wxPG_PROP_NOEDITOR; + } + + wxString flags; + + if ( p->IsCategory() ) + { + if ( distrib(s_rng) != 0 ) // random Boolean value + { + if ( !flags.empty() ) + { + flags.append("|"); + } + flags.append("COLLAPSED"); + } + } + + if ( distrib(s_rng) != 0 ) // random Boolean value + { + if ( !flags.empty() ) + { + flags.append("|"); + } + flags.append("DISABLED"); + } + + if ( distrib(s_rng) != 0 ) // random Boolean value + { + if ( !flags.empty() ) + { + flags.append("|"); + } + flags.append("HIDDEN"); + } + + // Set flags + p->SetFlagsFromString(flags); + + // Verify if flags have been properly set + if ( flags.Find("COLLAPSED") != wxNOT_FOUND && + !p->HasFlag(wxPG_PROP_COLLAPSED) ) + { + FAIL_CHECK(wxString::Format("Error setting flag from string 'COLLAPSED' for property '%s'", + p->GetName()).c_str()); + } + if ( flags.Find("COLLAPSED") == wxNOT_FOUND && + p->HasFlag(wxPG_PROP_COLLAPSED) ) + { + FAIL_CHECK(wxString::Format("Error resetting flag from string 'COLLAPSED'for property '%s'", + p->GetName()).c_str()); + } + if ( flags.Find("DISABLED") != wxNOT_FOUND && + !p->HasFlag(wxPG_PROP_DISABLED) ) + { + FAIL_CHECK(wxString::Format("Error setting flag from string 'DISABLED' for property '%s'", + p->GetName()).c_str()); + } + if ( flags.Find("DISABLED") == wxNOT_FOUND && + p->HasFlag(wxPG_PROP_DISABLED) ) + { + FAIL_CHECK(wxString::Format("Error resetting flag from string 'DISABLED' for property '%s'", + p->GetName()).c_str()); + } + if ( flags.Find("HIDDEN") != wxNOT_FOUND && + !p->HasFlag(wxPG_PROP_HIDDEN) ) + { + FAIL_CHECK(wxString::Format("Error setting flag from string 'HIDDEN' for property '%s'", + p->GetName()).c_str()); + } + if ( flags.Find("HIDDEN") == wxNOT_FOUND && + p->HasFlag(wxPG_PROP_HIDDEN) ) + { + FAIL_CHECK(wxString::Format("Error resetting flag from string 'HIDDEN' for property '%s'", + p->GetName()).c_str()); + } + + // Get individual flags + bool ok; + + flags = p->GetFlagsAsString(wxPG_PROP_COLLAPSED); + if ( p->HasFlag(wxPG_PROP_COLLAPSED) ) + { + ok = (flags == "COLLAPSED"); + } + else + { + ok = flags.empty(); + } + if ( !ok ) + { + FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'", + p->GetName()).c_str()); + } + + flags = p->GetFlagsAsString(wxPG_PROP_DISABLED); + if ( p->HasFlag(wxPG_PROP_DISABLED) ) + { + ok = (flags == "DISABLED"); + } + else + { + ok = flags.empty(); + } + if ( !ok ) + { + FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_DISABLED flag for property '%s'", + p->GetName()).c_str()); + } + + flags = p->GetFlagsAsString(wxPG_PROP_HIDDEN); + if ( p->HasFlag(wxPG_PROP_HIDDEN) ) + { + ok = (flags == "HIDDEN"); + } + else + { + ok = flags.empty(); + } + if ( !ok ) + { + FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'", + p->GetName()).c_str()); + } + + flags = p->GetFlagsAsString(wxPG_PROP_NOEDITOR); + if ( p->HasFlag(wxPG_PROP_NOEDITOR) ) + { + ok = (flags == "NOEDITOR"); + } + else + { + ok = flags.empty(); + } + if ( !ok ) + { + FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'", + p->GetName()).c_str()); + } + + // Get all flags + flags = p->GetFlagsAsString(wxPG_STRING_STORED_FLAGS); + if ( p->HasFlag(wxPG_PROP_COLLAPSED) ) + { + ok = (flags.Find("COLLAPSED") != wxNOT_FOUND); + } + else + { + ok = (flags.Find("COLLAPSED") == wxNOT_FOUND); + } + if ( !ok ) + { + FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_COLLAPSED flag for property '%s'", + p->GetName()).c_str()); + } + + if ( p->HasFlag(wxPG_PROP_DISABLED) ) + { + ok = (flags.Find("DISABLED") != wxNOT_FOUND); + } + else + { + ok = (flags.Find("DISABLED") == wxNOT_FOUND); + } + if ( !ok ) + { + FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_DISBALED flag for property '%s'", + p->GetName()).c_str()); + } + + if ( p->HasFlag(wxPG_PROP_HIDDEN) ) + { + ok = (flags.Find("HIDDEN") != wxNOT_FOUND); + } + else + { + ok = (flags.Find("HIDDEN") == wxNOT_FOUND); + } + if ( !ok ) + { + FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_HIDDEN flag for property '%s'", + p->GetName()).c_str()); + } + + if ( p->HasFlag(wxPG_PROP_NOEDITOR) ) + { + ok = (flags.Find("NOEDITOR") != wxNOT_FOUND); + } + else + { + ok = (flags.Find("NOEDITOR") == wxNOT_FOUND); + } + if ( !ok ) + { + FAIL_CHECK(wxString::Format("Invalid string for wxPG_PROP_NOEDITOR flag for property '%s'", + p->GetName()).c_str()); + } + + // Restore original flags + p->ChangeFlag(wxPG_PROP_COLLAPSED, (oldFlags & wxPG_PROP_COLLAPSED) != 0); + p->ChangeFlag(wxPG_PROP_DISABLED, (oldFlags & wxPG_PROP_DISABLED) != 0); + p->ChangeFlag(wxPG_PROP_HIDDEN, (oldFlags & wxPG_PROP_HIDDEN) != 0); + p->ChangeFlag(wxPG_PROP_NOEDITOR, (oldFlags & wxPG_PROP_NOEDITOR) != 0); + } + } + } + + SECTION("MultipleColumns") + { + // Test with multiple columns + for ( int i = 3; i < 12; i += 2 ) + { + INFO(wxString::Format("%i columns", i).c_str()); + pgManager->SetColumnCount(i); + pgManager->Refresh(); + pgManager->Update(); + wxMilliSleep(500); + } + SUCCEED(); + } + + SECTION("WindowStyles") + { + // Recreate grid with all possible (single) flags + REQUIRE(wxPG_AUTO_SORT == 0x000000010); + + for ( int i = 4; i < 16; i++ ) + { + int flag = 1 << i; + INFO(wxString::Format("Style: 0x%X", flag).c_str()); + ReplaceGrid(pgManager, flag, -1); + pgManager->Update(); + wxMilliSleep(500); + } + SUCCEED(); + + REQUIRE(wxPG_EX_INIT_NOCAT == 0x00001000); + + for ( int i = 12; i < 27; i++ ) + { + int flag = 1 << i; + INFO(wxString::Format("ExStyle: 0x%X", flag).c_str()); + ReplaceGrid(pgManager, -1, flag); + pgManager->Update(); + wxMilliSleep(500); + } + SUCCEED(); + } +} +#endif // wxUSE_PROPGRID diff --git a/tests/makefile.gcc b/tests/makefile.gcc index 4837241d19..d6e8ef3a03 100644 --- a/tests/makefile.gcc +++ b/tests/makefile.gcc @@ -199,6 +199,7 @@ TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_ownerdrawncomboboxtest.o \ $(OBJS)\test_gui_pickerbasetest.o \ $(OBJS)\test_gui_pickertest.o \ + $(OBJS)\test_gui_propgridtest.o \ $(OBJS)\test_gui_radioboxtest.o \ $(OBJS)\test_gui_radiobuttontest.o \ $(OBJS)\test_gui_rearrangelisttest.o \ @@ -334,6 +335,10 @@ ifeq ($(MONOLITHIC),0) __WXLIB_HTML_p = \ -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html endif +ifeq ($(MONOLITHIC),0) +__WXLIB_PROPGRID_p = \ + -lwx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid +endif ifeq ($(USE_GUI),1) __test_allheaders___depname = $(OBJS)\test_allheaders.exe endif @@ -520,7 +525,7 @@ ifeq ($(USE_GUI),1) $(OBJS)\test_gui.exe: $(TEST_GUI_OBJECTS) $(OBJS)\test_gui_sample_rc.o $(foreach f,$(subst \,/,$(TEST_GUI_OBJECTS)),$(shell echo $f >> $(subst \,/,$@).rsp.tmp)) @move /y $@.rsp.tmp $@.rsp >nul - $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) -limm32 $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme + $(CXX) -o $@ @$@.rsp $(__DEBUGINFO) $(__THREADSFLAG) -L$(LIBDIRNAME) $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) -limm32 $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_PROPGRID_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) -lwxzlib$(WXDEBUGFLAG) -lwxregexu$(WXDEBUGFLAG) -lwxexpat$(WXDEBUGFLAG) $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lole32 -loleaut32 -luuid -lrpcrt4 -ladvapi32 -lversion -lws2_32 -lwininet -loleacc -luxtheme @-del $@.rsp endif @@ -996,6 +1001,9 @@ $(OBJS)\test_gui_pickerbasetest.o: ./controls/pickerbasetest.cpp $(OBJS)\test_gui_pickertest.o: ./controls/pickertest.cpp $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\test_gui_propgridtest.o: ./controls/propgridtest.cpp + $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\test_gui_radioboxtest.o: ./controls/radioboxtest.cpp $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< diff --git a/tests/makefile.vc b/tests/makefile.vc index c3bf13ab72..c6f5a7ad37 100644 --- a/tests/makefile.vc +++ b/tests/makefile.vc @@ -212,6 +212,7 @@ TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_ownerdrawncomboboxtest.obj \ $(OBJS)\test_gui_pickerbasetest.obj \ $(OBJS)\test_gui_pickertest.obj \ + $(OBJS)\test_gui_propgridtest.obj \ $(OBJS)\test_gui_radioboxtest.obj \ $(OBJS)\test_gui_radiobuttontest.obj \ $(OBJS)\test_gui_rearrangelisttest.obj \ @@ -517,6 +518,10 @@ __WXLIB_XRC_p = \ __WXLIB_HTML_p = \ wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_html.lib !endif +!if "$(MONOLITHIC)" == "0" +__WXLIB_PROPGRID_p = \ + wx$(PORTNAME)$(WXUNIVNAME)$(WX_RELEASE_NODOT)u$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_propgrid.lib +!endif !if "$(USE_GUI)" == "1" __test_allheaders___depname = $(OBJS)\test_allheaders.exe !endif @@ -816,7 +821,7 @@ $(OBJS)\test_drawingplugin.dll: $(TEST_DRAWINGPLUGIN_OBJECTS) !if "$(USE_GUI)" == "1" $(OBJS)\test_gui.exe: $(OBJS)\test_gui_dummy.obj $(TEST_GUI_OBJECTS) $(OBJS)\test_gui_sample.res link /NOLOGO /OUT:$@ $(__DEBUGINFO_5) /pdb:"$(OBJS)\test_gui.pdb" $(__DEBUGINFO_51) $(LINK_TARGET_CPU) /LIBPATH:$(LIBDIRNAME) $(WIN32_DPI_LINKFLAG) /SUBSYSTEM:CONSOLE $(____CAIRO_LIBDIR_FILENAMES) $(LDFLAGS) @<< - $(TEST_GUI_OBJECTS) $(TEST_GUI_RESOURCES) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) imm32.lib $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib + $(TEST_GUI_OBJECTS) $(TEST_GUI_RESOURCES) $(__WXLIB_WEBVIEW_p) $(__WXLIB_STC_p) imm32.lib $(__WXLIB_AUI_p) $(__WXLIB_RICHTEXT_p) $(__WXLIB_MEDIA_p) $(__WXLIB_XRC_p) $(__WXLIB_XML_p) $(__WXLIB_HTML_p) $(__WXLIB_PROPGRID_p) $(__WXLIB_CORE_p) $(__WXLIB_NET_p) $(__WXLIB_BASE_p) $(__WXLIB_MONO_p) $(__LIB_SCINTILLA_IF_MONO_p) $(__LIB_TIFF_p) $(__LIB_JPEG_p) $(__LIB_PNG_p) wxzlib$(WXDEBUGFLAG).lib wxregexu$(WXDEBUGFLAG).lib wxexpat$(WXDEBUGFLAG).lib $(EXTRALIBS_FOR_BASE) $(__CAIRO_LIB_p) kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib shlwapi.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib version.lib ws2_32.lib wininet.lib << !endif @@ -1291,6 +1296,9 @@ $(OBJS)\test_gui_pickerbasetest.obj: .\controls\pickerbasetest.cpp $(OBJS)\test_gui_pickertest.obj: .\controls\pickertest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\pickertest.cpp +$(OBJS)\test_gui_propgridtest.obj: .\controls\propgridtest.cpp + $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\propgridtest.cpp + $(OBJS)\test_gui_radioboxtest.obj: .\controls\radioboxtest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\radioboxtest.cpp diff --git a/tests/test.bkl b/tests/test.bkl index b6a962aa60..5bd7328665 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -223,6 +223,7 @@ controls/ownerdrawncomboboxtest.cpp controls/pickerbasetest.cpp controls/pickertest.cpp + controls/propgridtest.cpp controls/radioboxtest.cpp controls/radiobuttontest.cpp controls/rearrangelisttest.cpp @@ -304,6 +305,7 @@ xrc xml html + propgrid core net base diff --git a/tests/test_gui.vcxproj b/tests/test_gui.vcxproj index dec3d8a090..7b4a193bc1 100644 --- a/tests/test_gui.vcxproj +++ b/tests/test_gui.vcxproj @@ -153,7 +153,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\single_include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)ud_propgrid.lib;wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -194,7 +194,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\single_include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)u_propgrid.lib;wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -239,7 +239,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\single_include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)ud_propgrid.lib;wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -280,7 +280,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\single_include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)u_propgrid.lib;wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -325,7 +325,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\single_include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)ud_propgrid.lib;wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -366,7 +366,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\single_include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)u_propgrid.lib;wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -411,7 +411,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\single_include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)ud_propgrid.lib;wxmsw$(wxShortVersionString)ud_webview.lib;wxmsw$(wxShortVersionString)ud_richtext.lib;wxmsw$(wxShortVersionString)ud_stc.lib;wxmsw$(wxShortVersionString)ud_aui.lib;wxmsw$(wxShortVersionString)ud_media.lib;wxmsw$(wxShortVersionString)ud_xrc.lib;wxbase$(wxShortVersionString)ud_xml.lib;wxmsw$(wxShortVersionString)ud_html.lib;wxmsw$(wxShortVersionString)ud_core.lib;wxbase$(wxShortVersionString)ud_net.lib;wxbase$(wxShortVersionString)ud.lib;wxtiffd.lib;wxjpegd.lib;wxpngd.lib;wxzlibd.lib;wxregexud.lib;wxexpatd.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -452,7 +452,7 @@ ..\lib\$(wxOutDirName)\$(wxIncSubDir);.\..\include;..\3rdparty\catch\single_include;.;.\..\samples;%(AdditionalIncludeDirectories) - wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) + wxmsw$(wxShortVersionString)u_propgrid.lib;wxmsw$(wxShortVersionString)u_webview.lib;wxmsw$(wxShortVersionString)u_richtext.lib;wxmsw$(wxShortVersionString)u_stc.lib;wxmsw$(wxShortVersionString)u_aui.lib;wxmsw$(wxShortVersionString)u_media.lib;wxmsw$(wxShortVersionString)u_xrc.lib;wxbase$(wxShortVersionString)u_xml.lib;wxmsw$(wxShortVersionString)u_html.lib;wxmsw$(wxShortVersionString)u_core.lib;wxbase$(wxShortVersionString)u_net.lib;wxbase$(wxShortVersionString)u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;winmm.lib;shell32.lib;comctl32.lib;ole32.lib;oleaut32.lib;uuid.lib;rpcrt4.lib;advapi32.lib;ws2_32.lib;wininet.lib;%(AdditionalDependencies) true ..\lib\$(wxOutDirName);%(AdditionalLibraryDirectories) true @@ -503,6 +503,7 @@ + @@ -589,4 +590,4 @@ - + \ No newline at end of file diff --git a/tests/test_gui.vcxproj.filters b/tests/test_gui.vcxproj.filters index 56ae8cf9ce..ff4a0f24e7 100644 --- a/tests/test_gui.vcxproj.filters +++ b/tests/test_gui.vcxproj.filters @@ -182,6 +182,9 @@ Source Files + + Source Files + Source Files diff --git a/tests/test_gui_vc14.sln b/tests/test_gui_vc14.sln index 700978687e..4b0a4d067d 100644 --- a/tests/test_gui_vc14.sln +++ b/tests/test_gui_vc14.sln @@ -15,6 +15,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_gui", "test_gui.vcxpro {8BD8F8D9-4275-5B42-A8F4-F1DB2970A550} = {8BD8F8D9-4275-5B42-A8F4-F1DB2970A550} {69F2EDE4-7D21-5738-9BC0-F66F61C9AE00} = {69F2EDE4-7D21-5738-9BC0-F66F61C9AE00} {33CC42F9-7756-5587-863C-8D4461B7C5DD} = {33CC42F9-7756-5587-863C-8D4461B7C5DD} + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63} = {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "..\build\msw\wx_base.vcxproj", "{3FCC50C2-81E9-5DB2-B8D8-2129427568B1}" @@ -37,6 +38,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webview", "..\build\msw\wx_ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aui", "..\build\msw\wx_aui.vcxproj", "{A16D3832-0F42-57CE-8F48-50E06649ADE8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "propgrid", "..\build\msw\wx_propgrid.vcxproj", "{97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -225,6 +228,22 @@ Global {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|Win32.Build.0 = Release|Win32 {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|x64.ActiveCfg = Release|x64 {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|x64.Build.0 = Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|Win32.ActiveCfg = Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|Win32.Build.0 = Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|x64.ActiveCfg = Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|x64.Build.0 = Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|Win32.Build.0 = DLL Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|x64.ActiveCfg = DLL Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|x64.Build.0 = DLL Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|Win32.ActiveCfg = DLL Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|Win32.Build.0 = DLL Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|x64.ActiveCfg = DLL Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|x64.Build.0 = DLL Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|Win32.ActiveCfg = Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|Win32.Build.0 = Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|x64.ActiveCfg = Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tests/test_gui_vc15.sln b/tests/test_gui_vc15.sln index a733fff840..7676c3cedc 100644 --- a/tests/test_gui_vc15.sln +++ b/tests/test_gui_vc15.sln @@ -15,6 +15,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_gui", "test_gui.vcxpro {8BD8F8D9-4275-5B42-A8F4-F1DB2970A550} = {8BD8F8D9-4275-5B42-A8F4-F1DB2970A550} {69F2EDE4-7D21-5738-9BC0-F66F61C9AE00} = {69F2EDE4-7D21-5738-9BC0-F66F61C9AE00} {33CC42F9-7756-5587-863C-8D4461B7C5DD} = {33CC42F9-7756-5587-863C-8D4461B7C5DD} + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63} = {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "..\build\msw\wx_base.vcxproj", "{3FCC50C2-81E9-5DB2-B8D8-2129427568B1}" @@ -37,6 +38,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webview", "..\build\msw\wx_ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aui", "..\build\msw\wx_aui.vcxproj", "{A16D3832-0F42-57CE-8F48-50E06649ADE8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "propgrid", "..\build\msw\wx_propgrid.vcxproj", "{97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -225,6 +228,22 @@ Global {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|Win32.Build.0 = Release|Win32 {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|x64.ActiveCfg = Release|x64 {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|x64.Build.0 = Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|Win32.ActiveCfg = Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|Win32.Build.0 = Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|x64.ActiveCfg = Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|x64.Build.0 = Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|Win32.Build.0 = DLL Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|x64.ActiveCfg = DLL Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|x64.Build.0 = DLL Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|Win32.ActiveCfg = DLL Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|Win32.Build.0 = DLL Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|x64.ActiveCfg = DLL Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|x64.Build.0 = DLL Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|Win32.ActiveCfg = Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|Win32.Build.0 = Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|x64.ActiveCfg = Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/tests/test_gui_vc16.sln b/tests/test_gui_vc16.sln index e0e8e76011..72ee6b8bfa 100644 --- a/tests/test_gui_vc16.sln +++ b/tests/test_gui_vc16.sln @@ -15,6 +15,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_gui", "test_gui.vcxpro {8BD8F8D9-4275-5B42-A8F4-F1DB2970A550} = {8BD8F8D9-4275-5B42-A8F4-F1DB2970A550} {69F2EDE4-7D21-5738-9BC0-F66F61C9AE00} = {69F2EDE4-7D21-5738-9BC0-F66F61C9AE00} {33CC42F9-7756-5587-863C-8D4461B7C5DD} = {33CC42F9-7756-5587-863C-8D4461B7C5DD} + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63} = {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "base", "..\build\msw\wx_base.vcxproj", "{3FCC50C2-81E9-5DB2-B8D8-2129427568B1}" @@ -37,6 +38,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "webview", "..\build\msw\wx_ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aui", "..\build\msw\wx_aui.vcxproj", "{A16D3832-0F42-57CE-8F48-50E06649ADE8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "propgrid", "..\build\msw\wx_propgrid.vcxproj", "{97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -225,6 +228,22 @@ Global {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|Win32.Build.0 = Release|Win32 {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|x64.ActiveCfg = Release|x64 {A16D3832-0F42-57CE-8F48-50E06649ADE8}.Release|x64.Build.0 = Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|Win32.ActiveCfg = Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|Win32.Build.0 = Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|x64.ActiveCfg = Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Debug|x64.Build.0 = Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|Win32.Build.0 = DLL Debug|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|x64.ActiveCfg = DLL Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Debug|x64.Build.0 = DLL Debug|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|Win32.ActiveCfg = DLL Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|Win32.Build.0 = DLL Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|x64.ActiveCfg = DLL Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.DLL Release|x64.Build.0 = DLL Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|Win32.ActiveCfg = Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|Win32.Build.0 = Release|Win32 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|x64.ActiveCfg = Release|x64 + {97FDAB45-9C58-5BC5-A2F4-EE42739EBC63}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE