def test_set_icon_none_after_none(self): path_main = 'tmp' controller = IconController(path_main) controller.set_icon(self._page, None) self.assertIsNone(self._page.icon)
def test_set_icon_custom_remove_param(self): self._page.params.iconOption.value = u'icon.png' path_main = u'tmp' controller = IconController(path_main) icon_path = u'../test/images/icon.png' controller.set_icon(self._page, icon_path) self.assertEqual(self._page.params.iconOption.value, u'')
def test_set_icon_custom_remove_param(self): self._page.params.iconOption.value = 'icon.png' path_main = 'tmp' controller = IconController(path_main) icon_path = '../test/images/icon.png' controller.set_icon(self._page, icon_path) self.assertEqual(self._page.params.iconOption.value, '')
def test_set_icon_none_after_custom(self): path_main = 'tmp' controller = IconController(path_main) icon_path = 'testdata/images/icon.png' controller.set_icon(self._page, icon_path) controller.set_icon(self._page, None) self.assertIsNone(self._page.icon)
def test_set_icon_custom_ico(self): path_main = 'tmp' controller = IconController(path_main) icon_path = '../test/images/icon.ico' controller.set_icon(self._page, icon_path) self.assertTrue(os.path.exists( os.path.join(self._page.path, PAGE_ICON_NAME + '.ico')) )
def test_set_icon_none_after_builtin(self): path_main = 'tmp' controller = IconController(path_main) icon_fname = ICONS_STD_PREFIX + 'icon.png' icon_path = os.path.join(path_main, icon_fname) controller.set_icon(self._page, icon_path) controller.set_icon(self._page, None) self.assertIsNone(self._page.icon)
def test_set_icon_builtin_01(self): path_main = 'tmp' controller = IconController(path_main) icon_fname = ICONS_STD_PREFIX + 'icon.png' icon_path = os.path.join(path_main, icon_fname) controller.set_icon(self._page, icon_path) self.assertNotEqual(self._page.params.iconOption.value, '') self.assertEqual(icon_fname, self._page.params.iconOption.value)
def test_set_icon_custom_ico(self): path_main = u'tmp' controller = IconController(path_main) icon_path = u'../test/images/icon.ico' controller.set_icon(self._page, icon_path) self.assertTrue(os.path.exists( os.path.join(self._page.path, PAGE_ICON_NAME + u'.ico')) )
def test_set_icon_builtin_01(self): path_main = u'tmp' controller = IconController(path_main) icon_fname = ICONS_STD_PREFIX + u'icon.png' icon_path = os.path.join(path_main, icon_fname) controller.set_icon(self._page, icon_path) self.assertNotEqual(self._page.params.iconOption.value, u'') self.assertEqual(icon_fname, self._page.params.iconOption.value)
def test_set_icon_custom_jpeg(self): path_main = 'tmp' controller = IconController(path_main) icon_path = 'testdata/images/icon.jpeg' controller.set_icon(self._page, icon_path) self.assertTrue(os.path.exists( os.path.join(self._page.path, PAGE_ICON_NAME + '.jpeg')) )
def test_set_icon_builtin_04(self): path_main = 'tmp' controller = IconController(path_main) icon_fname = os.path.join('подпапка', ICONS_STD_PREFIX + 'icon.png') icon_path = os.path.join(path_main, icon_fname) icon_path = os.path.abspath(icon_path) controller.set_icon(self._page, icon_path) self.assertNotEqual(self._page.params.iconOption.value, '') self.assertEqual(icon_fname, self._page.params.iconOption.value)
def test_set_icon_builtin_event(self): path_main = u'tmp' controller = IconController(path_main) icon_fname = ICONS_STD_PREFIX + u'icon.png' icon_path = os.path.join(path_main, icon_fname) self.assertEqual(self.eventcount, 0) controller.set_icon(self._page, icon_path) self.assertEqual(self.eventcount, 1) controller.set_icon(self._page, icon_path) self.assertEqual(self.eventcount, 2)
def test_set_icon_builtin_event(self): path_main = 'tmp' controller = IconController(path_main) icon_fname = ICONS_STD_PREFIX + 'icon.png' icon_path = os.path.join(path_main, icon_fname) self.assertEqual(self.eventcount, 0) controller.set_icon(self._page, icon_path) self.assertEqual(self.eventcount, 1) controller.set_icon(self._page, icon_path) self.assertEqual(self.eventcount, 2)
def test_set_icon_custom_event(self): self._page.params.iconOption.value = u'icon.png' path_main = u'tmp' controller = IconController(path_main) icon_path = u'../test/images/icon.png' self.assertEqual(self.eventcount, 0) controller.set_icon(self._page, icon_path) self.assertEqual(self.eventcount, 1) controller.set_icon(self._page, icon_path) self.assertEqual(self.eventcount, 2)
def test_set_icon_custom_event(self): self._page.params.iconOption.value = 'icon.png' path_main = 'tmp' controller = IconController(path_main) icon_path = '../test/images/icon.png' self.assertEqual(self.eventcount, 0) controller.set_icon(self._page, icon_path) self.assertEqual(self.eventcount, 1) controller.set_icon(self._page, icon_path) self.assertEqual(self.eventcount, 2)
def test_set_icon_builtin_remove_files(self): path_main = 'tmp' # Create icons files in the page folder for extension in ICONS_EXTENSIONS: icon_fname = os.path.join(self._page.path, PAGE_ICON_NAME + '.' + extension) self._create_file(icon_fname) controller = IconController(path_main) icon_fname = os.path.join('подпапка', ICONS_STD_PREFIX + 'icon.png') icon_path = os.path.join(path_main, icon_fname) controller.set_icon(self._page, icon_path) # Checking custom icon files for extension in ICONS_EXTENSIONS: icon_fname = os.path.join(self._page.path, PAGE_ICON_NAME + '.' + extension) self.assertFalse(os.path.exists(icon_fname), icon_fname)
def test_set_icon_builtin_remove_files(self): path_main = 'tmp' # Create icons files in the page folder for extension in ICONS_EXTENSIONS: icon_fname = os.path.join(self._page.path, PAGE_ICON_NAME + '.' + extension) self._create_file(icon_fname) controller = IconController(path_main) icon_fname = os.path.join( 'подпапка', ICONS_STD_PREFIX + 'icon.png') icon_path = os.path.join(path_main, icon_fname) controller.set_icon(self._page, icon_path) # Checking custom icon files for extension in ICONS_EXTENSIONS: icon_fname = os.path.join(self._page.path, PAGE_ICON_NAME + '.' + extension) self.assertFalse(os.path.exists(icon_fname), icon_fname)