Skip to content

Commit 7038216

Browse files
committed
TST: cover ParametersPanel.onPopupFixFree method
1 parent b5bd653 commit 7038216

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/diffpy/pdfgui/tests/TestParametersPanel.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,28 @@ def _leftclickcell(self, row, col, **kw):
5858
return
5959

6060

61+
def test_onPopupFixFree(self):
62+
"Check ParametersPanel.onPopupFixFree"
63+
# event is not used, we just generate and reuse dummy event.
64+
e = wx.PyCommandEvent(wx.EVT_MENU.typeId, wx.ID_ANY)
65+
panel = self.panel
66+
gp = self.panel.grid_parameters
67+
plist = list(self.panel.parameters.values())
68+
gp.SetCellValue(0, 1, "")
69+
self.assertTrue(all(not p.fixed for p in plist))
70+
gp.SelectAll()
71+
panel.onPopupFixFree(e)
72+
self.assertTrue(all(p.fixed for p in plist))
73+
self.assertEqual("1", gp.GetCellValue(0, 1))
74+
panel.onPopupFixFree(e)
75+
self.assertTrue(all(not p.fixed for p in plist))
76+
gp.DeselectRow(0)
77+
panel.onPopupFixFree(e)
78+
self.assertFalse(plist[0].fixed)
79+
self.assertTrue(plist[1].fixed)
80+
return
81+
82+
6183
def test_applyCellChange(self):
6284
"Check ParametersPanel.applyCellChange"
6385
gp = self.panel.grid_parameters

0 commit comments

Comments
 (0)