mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2025-09-05 01:10:12 +02:00
* Changed imports to use either absolute or explicit relative imports. Implicit relative imports are no longer allowed. * Changes to accomodate standard library classes or modues moving to other locations, or being removed entirely. * Changes related to print becoming a function, execfile being removed, u'' no longer allowed, and other syntax related issues. * Working around C APIs that have changed or simply vanished. (PyInt, PyString, PyBytes, etc.) * Dealing with text file objects using strings vs binary file objects using bytes, auto-encoding, and etc. * Replacing the use of PyCObject with PyCapsule and dealing with an apparent bug where PyCapsule objects can't be imported from submodules within a package. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71554 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
47 lines
1.7 KiB
Python
47 lines
1.7 KiB
Python
import imp_unittest, unittest
|
|
import wtc
|
|
import wx
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
class mimetype_Tests(wtc.WidgetTestCase):
|
|
|
|
def test_mimetype1(self):
|
|
ft = wx.TheMimeTypesManager.GetFileTypeFromExtension('*.pdf')
|
|
if ft:
|
|
ft.GetExtensions()
|
|
ft.GetMimeType()
|
|
ft.GetIcon()
|
|
|
|
def test_mimetype2(self):
|
|
ft = wx.TheMimeTypesManager.GetFileTypeFromMimeType('image/png')
|
|
if ft:
|
|
ft.GetExtensions()
|
|
ft.GetMimeType()
|
|
ft.GetIcon()
|
|
|
|
def test_mimetype3(self):
|
|
fti = wx.FileTypeInfo('mime', 'open', 'print', 'desc', 'ext1')
|
|
fti.AddExtension('ext2')
|
|
fti.AddExtension('ext3')
|
|
self.assertEqual(fti.GetMimeType(), 'mime')
|
|
self.assertEqual(fti.GetOpenCommand(), 'open')
|
|
self.assertEqual(fti.GetPrintCommand(), 'print')
|
|
self.assertEqual(fti.GetDescription(), 'desc')
|
|
self.assertEqual(fti.GetExtensions(), ['ext1', 'ext2', 'ext3'])
|
|
self.assertEqual(fti.GetExtensionsCount(), 3)
|
|
|
|
def test_mimetype4(self):
|
|
fti = wx.FileTypeInfo(['mime', 'open', 'print', 'desc', 'ext1', 'ext2', 'ext3'])
|
|
self.assertEqual(fti.GetMimeType(), 'mime')
|
|
self.assertEqual(fti.GetOpenCommand(), 'open')
|
|
self.assertEqual(fti.GetPrintCommand(), 'print')
|
|
self.assertEqual(fti.GetDescription(), 'desc')
|
|
self.assertEqual(fti.GetExtensions(), ['ext1', 'ext2', 'ext3'])
|
|
self.assertEqual(fti.GetExtensionsCount(), 3)
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|