class StaticTestCases(unittest.TestCase): """Unit tests for the StaticWrapper class""" def setUp(self): """Start the sample application. Open a tab with ownerdraw button.""" Timings.defaults() self.app = Application().start(os.path.join(mfc_samples_folder, u"RebarTest.exe")) # open the Help dailog self.app.active().type_keys('%h{ENTER}') def tearDown(self): """Close the application after tests""" self.app.kill() def test_NeedsImageProp(self): """test a regular static has no the image property""" active_window = self.app.active() self.assertEqual(active_window.Static2._needs_image_prop, False) self.assertEqual('image' in active_window.Static2.get_properties(), False) #self.assertNotIn('image', active_window.Static2.get_properties()) # assertIn and assertNotIn are not supported in Python 2.6 def test_NeedsImageProp_ownerdraw(self): """test whether an image needs to be saved with the properties""" active_window = self.app.active() self.assertEqual(active_window.Static._needs_image_prop, True) self.assertEqual('image' in active_window.Static.get_properties(), True)
class ButtonOwnerdrawTestCases(unittest.TestCase): """Unit tests for the ButtonWrapper(ownerdraw button)""" def setUp(self): """Start the sample application. Open a tab with ownerdraw button.""" _set_timings_fast() self.app = Application().start(os.path.join(mfc_samples_folder, u"CmnCtrl3.exe")) # open the needed tab self.app.active().TabControl.select(1) def tearDown(self): """Close the application after tests""" self.app.kill() def test_NeedsImageProp(self): """test whether an image needs to be saved with the properties""" active_window = self.app.active() self.assertEqual(active_window.Button2._needs_image_prop, True) self.assertEqual('image' in active_window.Button2.get_properties(), True)
class StaticTestCases(unittest.TestCase): """Unit tests for the StaticWrapper class""" def setUp(self): """Start the sample application. Open a tab with ownerdraw button.""" Timings.defaults() self.app = Application().start( os.path.join(mfc_samples_folder, u"RebarTest.exe")) # open the Help dailog self.app.active().type_keys('%h{ENTER}') def tearDown(self): """Close the application after tests""" self.app.kill() def test_NeedsImageProp(self): """test a regular static has no the image property""" active_window = self.app.active() self.assertEqual(active_window.Static2._needs_image_prop, False) self.assertEqual('image' in active_window.Static2.get_properties(), False) #self.assertNotIn('image', active_window.Static2.get_properties()) # assertIn and assertNotIn are not supported in Python 2.6 def test_NeedsImageProp_ownerdraw(self): """test whether an image needs to be saved with the properties""" active_window = self.app.active() self.assertEqual(active_window.Static._needs_image_prop, True) self.assertEqual('image' in active_window.Static.get_properties(), True)
def _get_focus_app(self): app = Application().connect(active_only=True) active_window = app.active() wrapper = active_window.wrapper_object() app_view = AppViewer(app=app, active=active_window, wrapper=wrapper, rect=wrapper.rectangle()) return app_view
class ButtonOwnerdrawTestCases(unittest.TestCase): """Unit tests for the ButtonWrapper(ownerdraw button)""" def setUp(self): """Start the sample application. Open a tab with ownerdraw button.""" _set_timings_fast() self.app = Application().start( os.path.join(mfc_samples_folder, u"CmnCtrl3.exe")) # open the needed tab self.app.active().TabControl.select(1) def tearDown(self): """Close the application after tests""" self.app.kill() def test_NeedsImageProp(self): """test whether an image needs to be saved with the properties""" active_window = self.app.active() self.assertEqual(active_window.Button2._needs_image_prop, True) self.assertEqual('image' in active_window.Button2.get_properties(), True)