From 57aeaa382315d2bb9657eac163757e4d014da7e8 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Sun, 28 Apr 2019 16:30:28 +0200 Subject: [PATCH] Add some tests of wxPGAttributeStorage Check obtaining list of wxPGProperty attributes as wxPGAttributeStorage and making a copy of this list. --- samples/propgrid/tests.cpp | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/samples/propgrid/tests.cpp b/samples/propgrid/tests.cpp index 9e70fff1ce..5f86ed74ab 100644 --- a/samples/propgrid/tests.cpp +++ b/samples/propgrid/tests.cpp @@ -974,6 +974,54 @@ bool FormMain::RunTests( bool fullTest, bool interactive ) 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(); + } + } + #if WXWIN_COMPATIBILITY_3_0 { RT_START_TEST(DoubleToString)