def testAddCover_01_group(self):
        files = []
        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]

        groupname = u'Новая группа'

        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)
        collection.addGroup(groupname)
        collection.addIcons(groupname, fullPaths)

        coverpath = os.path.join(self.imagesDir, u'icon.png')

        newCoverPath = os.path.join(self.tempDir1, groupname,
                                    IconsCollection.COVER_FILE_NAME)

        collection.setCover(groupname, coverpath)
        self.assertTrue(os.path.exists(newCoverPath))
        self.assertEqual(os.path.abspath(newCoverPath),
                         os.path.abspath(collection.getCover(groupname)))

        collection.setCover(groupname, coverpath)
        self.assertTrue(
            os.path.exists(
                os.path.join(self.tempDir1, groupname,
                             IconsCollection.COVER_FILE_NAME)))
Example #2
0
    def testAddCover_01_group(self):
        files = []
        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]

        groupname = 'Новая группа'

        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)
        collection.addGroup(groupname)
        collection.addIcons(groupname, fullPaths)

        coverpath = os.path.join(self.imagesDir, 'icon.png')

        newCoverPath = os.path.join(self.tempDir1,
                                    groupname,
                                    IconsCollection.COVER_FILE_NAME)

        collection.setCover(groupname, coverpath)
        self.assertTrue(os.path.exists(newCoverPath))
        self.assertEqual(os.path.abspath(newCoverPath),
                         os.path.abspath(collection.getCover(groupname)))

        collection.setCover(groupname, coverpath)
        self.assertTrue(os.path.exists(os.path.join(
            self.tempDir1,
            groupname,
            IconsCollection.COVER_FILE_NAME))
        )
Example #3
0
    def testAddCover_04_root_invalid (self):
        os.mkdir (self.tempDir1)
        collection = IconsCollection (self.tempDir1)

        coverpath = os.path.join (self.imagesDir, u'invalid.png')

        collection.setCover (u'', coverpath)
        self.assertFalse (os.path.exists (os.path.join (self.tempDir1, IconsCollection.COVER_FILE_NAME)))
    def testAddCover_04_root_invalid(self):
        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)

        coverpath = os.path.join(self.imagesDir, u'invalid.png')

        collection.setCover(u'', coverpath)
        self.assertFalse(
            os.path.exists(
                os.path.join(self.tempDir1, IconsCollection.COVER_FILE_NAME)))
Example #5
0
    def testAddCover_05_root (self):
        os.mkdir (self.tempDir1)
        collection = IconsCollection (self.tempDir1)

        coverpath = os.path.join (self.imagesDir, u'first.jpg')

        collection.setCover (None, coverpath)
        self.assertTrue (os.path.exists (os.path.join (self.tempDir1, IconsCollection.COVER_FILE_NAME)))

        self.assertEqual (self.__getMaxImageSize (os.path.join (
            self.tempDir1,
            IconsCollection.COVER_FILE_NAME)), 16)
Example #6
0
    def testAddCover_03_root (self):
        os.mkdir (self.tempDir1)
        collection = IconsCollection (self.tempDir1)

        coverpath = os.path.join (self.imagesDir, u'icon.png')

        newCoverPath = os.path.join (self.tempDir1, IconsCollection.COVER_FILE_NAME)

        collection.setCover (u'', coverpath)
        self.assertTrue (os.path.exists (newCoverPath))
        self.assertEqual (os.path.abspath (newCoverPath), os.path.abspath (collection.getCover (None)))

        collection.setCover (u'', coverpath)
        self.assertTrue (os.path.exists (os.path.join (self.tempDir1, IconsCollection.COVER_FILE_NAME)))
    def testAddCover_05_root(self):
        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)

        coverpath = os.path.join(self.imagesDir, u'first.jpg')

        collection.setCover(None, coverpath)
        self.assertTrue(
            os.path.exists(
                os.path.join(self.tempDir1, IconsCollection.COVER_FILE_NAME)))

        self.assertEqual(
            self.__getMaxImageSize(
                os.path.join(self.tempDir1, IconsCollection.COVER_FILE_NAME)),
            16)
    def testAddCover_03_root(self):
        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)

        coverpath = os.path.join(self.imagesDir, u'icon.png')

        newCoverPath = os.path.join(self.tempDir1,
                                    IconsCollection.COVER_FILE_NAME)

        collection.setCover(u'', coverpath)
        self.assertTrue(os.path.exists(newCoverPath))
        self.assertEqual(os.path.abspath(newCoverPath),
                         os.path.abspath(collection.getCover(None)))

        collection.setCover(u'', coverpath)
        self.assertTrue(
            os.path.exists(
                os.path.join(self.tempDir1, IconsCollection.COVER_FILE_NAME)))