From 3d4155395b7f01a83e6bed6f925bbe4f441a2e0e Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Tue, 19 Jan 2021 10:07:50 -0800 Subject: [PATCH] Add test cases for GenericDirCtrl.GetPath and GetPaths --- unittests/test_dirctrl.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/unittests/test_dirctrl.py b/unittests/test_dirctrl.py index cec413e1..531bd08a 100644 --- a/unittests/test_dirctrl.py +++ b/unittests/test_dirctrl.py @@ -1,6 +1,9 @@ import unittest from unittests import wtc import wx +import os + +THIS_FILE = os.path.abspath(__file__) #--------------------------------------------------------------------------- @@ -22,6 +25,24 @@ class dirctrl_Tests(wtc.WidgetTestCase): wx.DIRCTRL_EDIT_LABELS wx.DIRCTRL_MULTIPLE + def test_dirctrlGetPath(self): + d = wx.GenericDirCtrl(self.frame) + d.ExpandPath(os.path.dirname(THIS_FILE)) + d.SelectPath(THIS_FILE) + p = d.GetPath() + assert isinstance(p, str) + assert p == THIS_FILE + + def test_dirctrlGetPaths(self): + d = wx.GenericDirCtrl(self.frame, style=wx.DIRCTRL_MULTIPLE) + d.ExpandPath(os.path.dirname(THIS_FILE)) + d.SelectPaths([THIS_FILE]) + p = d.GetPaths() + assert isinstance(p, list) + assert p == [THIS_FILE] + + + #--------------------------------------------------------------------------- if __name__ == '__main__':