Ejemplo n.º 1
0
    def testRemoveAttachDir1 (self):
        attach = Attachment (self.page)

        attach.attach (self.fullFilesPath)

        attach.removeAttach ([u"dir"])

        self.assertEqual (len (attach.attachmentFull), len (self.fullFilesPath[1:]))
Ejemplo n.º 2
0
    def testAttach1 (self):
        attach = Attachment (self.page)
        attach.attach (self.fullFilesPath)

        Application.wikiroot = self.wikiroot
        Application.wikiroot.selectedPage = self.page
        self.assertEqual (self.wnd.attachPanel.panel.attachList.GetItemCount(), len (self.fullFilesPath))

        attach.removeAttach ([self.files[0]])
        self.assertEqual (self.wnd.attachPanel.panel.attachList.GetItemCount(), len (self.fullFilesPath) - 1)
Ejemplo n.º 3
0
    def testAttach1(self):
        attach = Attachment(self.page)
        attach.attach(self.fullFilesPath)

        self.application.wikiroot = self.wikiroot
        self.application.wikiroot.selectedPage = self.page
        self.assertEqual(self.mainWindow.attachPanel.panel.attachList.GetItemCount(), len(self.fullFilesPath))

        attach.removeAttach([self.files[0]])
        self.assertEqual(self.mainWindow.attachPanel.panel.attachList.GetItemCount(), len(self.fullFilesPath) - 1)
Ejemplo n.º 4
0
    def testRemoveAttaches2 (self):
        attach = Attachment (self.page)
        attach2 = Attachment (self.page)

        attach.attach (self.fullFilesPath)

        attach.removeAttach ([self.files[0]])

        self.assertEqual (len (attach2.attachmentFull), len (self.fullFilesPath[1:]))

        attachBasenames = [os.path.basename (path) for path in attach2.attachmentFull]

        for path in self.fullFilesPath [1:]:
            self.assertTrue (os.path.basename (path) in attachBasenames, path)
Ejemplo n.º 5
0
    def test_attach_delete(self):
        self._application.wikiroot = self.wikiroot
        self._application.selectedPage = self.page_01
        self._attach_files(self.page_01, ['add.png'])

        watcher = AttachWatcher(self._application, self._period_ms)
        watcher.initialize()

        attach = Attachment(self.page_01)
        attach.removeAttach(['add.png'])

        wx.MilliSleep(500)
        self.myYield()
        watcher.clear()
        self.assertEqual(self._eventCount, 1)
Ejemplo n.º 6
0
    def test_attach_delete(self):
        self._application.wikiroot = self.wikiroot
        self._application.selectedPage = self.page_01
        self._attach_files(self.page_01, ['add.png'])

        watcher = AttachWatcher(self._application, self._period_ms)
        watcher.initialize()

        attach = Attachment(self.page_01)
        attach.removeAttach(['add.png'])

        wx.MilliSleep(500)
        self.myYield()
        watcher.clear()
        self.assertEqual(self._eventCount, 1)
Ejemplo n.º 7
0
    def testRemoveAttachesEvent (self):
        attach = Attachment (self.page)

        attach.attach (self.fullFilesPath)

        Application.onPageUpdate += self.onPageUpdate

        attach.removeAttach ([self.files[0]])

        self.assertEqual (len (attach.attachmentFull), len (self.fullFilesPath) - 1)
        self.assertEqual (self.pageUpdateCount, 1)
        self.assertEqual (self.pageUpdateSender, self.page)


        attach.removeAttach ([self.files[1], self.files[2]])

        self.assertEqual (len (attach.attachmentFull), len (self.fullFilesPath) - 3)
        self.assertEqual (self.pageUpdateCount, 2)
        self.assertEqual (self.pageUpdateSender, self.page)

        Application.onPageUpdate -= self.onPageUpdate