Various other propgrid related tweaks

This commit is contained in:
Robin Dunn
2017-09-14 19:57:26 -07:00
parent 90be887af6
commit 4ce9c2b46f
3 changed files with 26 additions and 18 deletions

View File

@@ -701,20 +701,22 @@ class TestPanel( wx.Panel ):
#
# Add properties
#
# NOTE: in this example the property names are used as variable names
# in one of the tests, so they need to be valid python identifiers.
#
pg.AddPage( "Page 1 - Testing All" )
pg.Append( wxpg.PropertyCategory("1 - Basic Properties") )
pg.Append( wxpg.StringProperty("String",value="Some Text") )
sp = pg.Append( wxpg.StringProperty('StringProperty w/ Password flag', value='ABadPassword') )
sp = pg.Append( wxpg.StringProperty('StringProperty_as_Password', value='ABadPassword') )
sp.SetAttribute('Hint', 'This is a hint')
sp.SetAttribute('Password', True)
pg.Append( wxpg.IntProperty("Int",value=100) )
pg.Append( wxpg.FloatProperty("Float",value=100.0) )
pg.Append( wxpg.BoolProperty("Bool",value=True) )
boolprop = pg.Append( wxpg.BoolProperty("Bool_with_Checkbox",value=True) )
pg.Append( wxpg.IntProperty("Int", value=100) )
self.fprop = pg.Append( wxpg.FloatProperty("Float", value=123.456) )
pg.Append( wxpg.BoolProperty("Bool", value=True) )
boolprop = pg.Append( wxpg.BoolProperty("Bool_with_Checkbox", value=True) )
pg.SetPropertyAttribute(
"Bool_with_Checkbox", # You can find the property by name,
#boolprop, # or give the property object itself.

View File

@@ -1,14 +1,20 @@
import unittest
from unittests import wtc
import wx
import wx.propgrid as pg
#---------------------------------------------------------------------------
class propgridmanager_Tests(wtc.WidgetTestCase):
# TODO: Remove this test and add real ones.
def test_propgridmanager1(self):
self.fail("Unit tests for propgridmanager not implemented yet.")
def test_propgridmanager01(self):
page = pg.PropertyGridPage()
def test_propgridmanager02(self):
mgr = pg.PropertyGridManager(self.frame)
page1 = mgr.AddPage('label')
#---------------------------------------------------------------------------

View File

@@ -48,15 +48,15 @@ class property_Tests(wtc.WidgetTestCase):
c = pg.PGCell()
def test_propgridproperty07(self):
attrs = pg.PGAttributeStorage()
attrs.Set('name', 'value')
attrs.Set('one', 1)
attrs.Set('two.one', 2.1)
attrs.Set('true', True)
assert attrs.GetCount() == 4
assert attrs.FindValue('name') == 'value'
# TODO: Add some iteration tests
# def test_propgridproperty07(self):
# attrs = pg.PGAttributeStorage()
# attrs.Set('name', 'value')
# attrs.Set('one', 1)
# attrs.Set('two.one', 2.1)
# attrs.Set('true', True)
# assert attrs.GetCount() == 4
# assert attrs.FindValue('name') == 'value'
# # TODO: Add some iteration tests
def test_propgridproperty08(self):