예제 #1
0
    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)
예제 #2
0
    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'')
예제 #3
0
    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, '')
예제 #4
0
    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)
예제 #5
0
    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'))
        )
예제 #6
0
    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)
예제 #7
0
    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)
예제 #8
0
    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'))
        )
예제 #9
0
    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)
예제 #10
0
    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'))
        )
예제 #11
0
    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)
예제 #12
0
    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)
예제 #13
0
    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)
예제 #14
0
    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)
예제 #15
0
    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)
예제 #16
0
    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)
예제 #17
0
    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)