Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsimpoir <simpoir@Bob.(none)>2009-01-30 04:14:48 (GMT)
committer simpoir <simpoir@Bob.(none)>2009-01-30 04:14:48 (GMT)
commiteaef567cabc5c0dda9706faa0e17e20909131ade (patch)
tree70c06b03713b88c5141ef21bcc155cd3dfe0dc92 /tests
ajout initial du tree jhbuild [jhbuild base]
Diffstat (limited to 'tests')
-rw-r--r--tests/graphics/common.py55
-rw-r--r--tests/graphics/hipposcalability.py50
-rw-r--r--tests/graphics/iconcache.py69
-rw-r--r--tests/graphics/iconwidget.py87
-rw-r--r--tests/graphics/ticket2855.py59
-rw-r--r--tests/graphics/ticket2999.py38
-rw-r--r--tests/graphics/ticket3000.py48
-rw-r--r--tests/graphics/toolbarpalettes.py65
-rw-r--r--tests/graphics/tray.py82
-rw-r--r--tests/lib/runall.py28
-rw-r--r--tests/lib/test_mime.py81
11 files changed, 662 insertions, 0 deletions
diff --git a/tests/graphics/common.py b/tests/graphics/common.py
new file mode 100644
index 0000000..2f00099
--- /dev/null
+++ b/tests/graphics/common.py
@@ -0,0 +1,55 @@
+# Copyright (C) 2007, Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+import gtk
+
+from sugar.graphics.toolbutton import ToolButton
+
+class Test(gtk.VBox):
+ def __init__(self):
+ gtk.VBox.__init__(self)
+
+class TestPalette(Test):
+ def __init__(self):
+ Test.__init__(self)
+
+ toolbar = gtk.Toolbar()
+
+ self._invoker = ToolButton('go-previous')
+ toolbar.insert(self._invoker, -1)
+ self._invoker.show()
+
+ self.pack_start(toolbar, False)
+ toolbar.show()
+
+ def set_palette(self, palette):
+ self._invoker.set_palette(palette)
+
+class TestRunner(object):
+ def run(self, test):
+ window = gtk.Window()
+ window.connect("destroy", lambda w: gtk.main_quit())
+ window.add(test)
+ test.show()
+
+ window.show()
+
+def main(test):
+ runner = TestRunner()
+ runner.run(test)
+
+ gtk.main()
diff --git a/tests/graphics/hipposcalability.py b/tests/graphics/hipposcalability.py
new file mode 100644
index 0000000..a5cebcc
--- /dev/null
+++ b/tests/graphics/hipposcalability.py
@@ -0,0 +1,50 @@
+import hippo
+import gtk
+import gobject
+
+from sugar.graphics.icon import CanvasIcon
+from sugar.graphics.roundbox import CanvasRoundBox
+
+import common
+
+test = common.Test()
+
+canvas = hippo.Canvas()
+test.pack_start(canvas)
+canvas.show()
+
+scrollbars = hippo.CanvasScrollbars()
+canvas.set_root(scrollbars)
+
+box = hippo.CanvasBox(padding=10, spacing=10)
+scrollbars.set_root(box)
+
+def idle_cb():
+ global countdown
+
+ for i in range(0, 100):
+ entry = hippo.CanvasBox(border=2, border_color=0x000000ff,
+ orientation=hippo.ORIENTATION_HORIZONTAL,
+ padding=10, spacing=10)
+
+ for j in range(0, 3):
+ icon = CanvasIcon(icon_name='go-left')
+ entry.append(icon)
+
+ for j in range(0, 2):
+ text = hippo.CanvasText(text='Text %s %s' % (countdown, j))
+ entry.append(text)
+
+ box.append(entry)
+
+ countdown -= 1
+
+ return countdown > 0
+
+countdown = 1000
+gobject.idle_add(idle_cb)
+
+test.show()
+
+if __name__ == "__main__":
+ common.main(test)
diff --git a/tests/graphics/iconcache.py b/tests/graphics/iconcache.py
new file mode 100644
index 0000000..b03ecb6
--- /dev/null
+++ b/tests/graphics/iconcache.py
@@ -0,0 +1,69 @@
+# Copyright (C) 2007, Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Test the sugar.graphics.icon.* cache.
+"""
+
+import gtk
+
+from sugar.graphics.icon import Icon
+from sugar.graphics.xocolor import XoColor
+
+import common
+
+test = common.Test()
+
+data = [
+ ['battery-000', '#FF8F00,#FF2B34'],
+ ['battery-010', '#D1A3FF,#00A0FF'],
+ ['battery-020', '#FF8F00,#FF2B34'],
+ ['battery-030', '#00A0FF,#D1A3FF'],
+ ['battery-040', '#AC32FF,#FF2B34'],
+ ['battery-050', '#D1A3FF,#00A0FF'],
+ ['battery-060', '#AC32FF,#FF2B34'],
+ ['battery-070', '#00A0FF,#D1A3FF'],
+ ['battery-080', '#FF8F00,#FF2B34'],
+ ['battery-090', '#D1A3FF,#00A0FF'],
+ ['battery-100', '#AC32FF,#FF2B34']]
+
+def _button_activated_cb(button):
+ import random
+
+ global data
+ random.shuffle(data)
+
+ for i in range(0, len(test.get_children()) - 1):
+ test.get_children()[i].props.icon_name = data[i][0]
+ test.get_children()[i].props.xo_color = XoColor(data[i][1])
+
+for d in data:
+ icon = Icon(icon_name=d[0],
+ icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
+ xo_color=XoColor(d[1]))
+ test.pack_start(icon)
+ icon.show()
+
+button = gtk.Button("mec mac")
+test.pack_start(button)
+button.connect('activate', _button_activated_cb)
+button.show()
+
+test.show()
+
+if __name__ == "__main__":
+ common.main(test)
diff --git a/tests/graphics/iconwidget.py b/tests/graphics/iconwidget.py
new file mode 100644
index 0000000..cacf501
--- /dev/null
+++ b/tests/graphics/iconwidget.py
@@ -0,0 +1,87 @@
+# Copyright (C) 2007, Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Test the sugar.graphics.icon.Icon widget.
+"""
+
+import gtk
+
+from sugar.graphics.icon import Icon
+from sugar.graphics.xocolor import XoColor
+
+import common
+
+test = common.Test()
+
+hbox = gtk.HBox()
+test.pack_start(hbox)
+sensitive_box = gtk.VBox()
+insensitive_box = gtk.VBox()
+
+hbox.pack_start(sensitive_box)
+hbox.pack_start(insensitive_box)
+hbox.show_all()
+
+
+def create_icon_widgets(box, sensitive=True):
+ icon = Icon(icon_name='go-previous')
+ icon.props.icon_size = gtk.ICON_SIZE_LARGE_TOOLBAR
+ box.pack_start(icon)
+ icon.set_sensitive(sensitive)
+ icon.show()
+
+ icon = Icon(icon_name='computer-xo',
+ icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
+ xo_color=XoColor())
+ box.pack_start(icon)
+ icon.set_sensitive(sensitive)
+ icon.show()
+
+ icon = Icon(icon_name='battery-000',
+ icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
+ badge_name='emblem-busy')
+ box.pack_start(icon)
+ icon.set_sensitive(sensitive)
+ icon.show()
+
+ icon = Icon(icon_name='gtk-new',
+ icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR,
+ badge_name='gtk-cancel')
+ box.pack_start(icon)
+ icon.set_sensitive(sensitive)
+ icon.show()
+
+
+create_icon_widgets(sensitive_box, True)
+create_icon_widgets(insensitive_box, False)
+
+test.show()
+
+# This can be used to test for leaks by setting the LRU cache size
+# in icon.py to 1.
+#def idle_cb():
+# import gc
+# gc.collect()
+# test.queue_draw()
+# return True
+#
+#import gobject
+#gobject.idle_add(idle_cb)
+
+if __name__ == "__main__":
+ common.main(test)
diff --git a/tests/graphics/ticket2855.py b/tests/graphics/ticket2855.py
new file mode 100644
index 0000000..cc4b3c0
--- /dev/null
+++ b/tests/graphics/ticket2855.py
@@ -0,0 +1,59 @@
+# Copyright (C) 2007, Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Test the style of toggle and radio buttons inside a palette. The buttons
+contains only an icon and should be rendered similarly to the toolbar
+controls. Ticket #2855.
+"""
+
+import gtk
+
+from sugar.graphics.palette import Palette
+from sugar.graphics.icon import Icon
+
+import common
+
+test = common.TestPalette()
+
+palette = Palette('Test radio and toggle')
+test.set_palette(palette)
+
+box = gtk.HBox()
+
+toggle = gtk.ToggleButton()
+
+icon = Icon(icon_name='go-previous', icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
+toggle.set_image(icon)
+
+box.pack_start(toggle, False)
+toggle.show()
+
+radio = gtk.RadioButton()
+
+icon = Icon(icon_name='go-next', icon_size=gtk.ICON_SIZE_LARGE_TOOLBAR)
+radio.set_image(icon)
+
+radio.set_mode(False)
+box.pack_start(radio, False)
+radio.show()
+
+palette.set_content(box)
+box.show()
+
+if __name__ == "__main__":
+ common.main(test)
diff --git a/tests/graphics/ticket2999.py b/tests/graphics/ticket2999.py
new file mode 100644
index 0000000..a7b92d5
--- /dev/null
+++ b/tests/graphics/ticket2999.py
@@ -0,0 +1,38 @@
+# Copyright (C) 2007, One Laptop Per Child
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Spec in ticket #2999.
+"""
+
+import gtk
+
+from sugar.graphics.palette import Palette
+from sugar.graphics.icon import Icon
+
+import common
+
+test = common.Test()
+test.set_border_width(60)
+
+text_view = gtk.TextView()
+text_view.props.buffer.props.text = 'Blah blah blah, blah blah blah.'
+test.pack_start(text_view)
+text_view.show()
+
+if __name__ == "__main__":
+ common.main(test)
diff --git a/tests/graphics/ticket3000.py b/tests/graphics/ticket3000.py
new file mode 100644
index 0000000..c28b2cb
--- /dev/null
+++ b/tests/graphics/ticket3000.py
@@ -0,0 +1,48 @@
+# Copyright (C) 2007, One Laptop Per Child
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Spec in ticket #3000.
+"""
+
+import gtk
+
+from sugar.graphics.toolbutton import ToolButton
+
+import common
+
+test = common.Test()
+
+toolbar = gtk.Toolbar()
+test.pack_start(toolbar, False)
+toolbar.show()
+
+button = ToolButton('go-previous')
+toolbar.insert(button, -1)
+button.show()
+
+separator = gtk.SeparatorToolItem()
+toolbar.add(separator)
+separator.show()
+
+button = ToolButton('go-next')
+toolbar.insert(button, -1)
+button.show()
+
+
+if __name__ == "__main__":
+ common.main(test)
diff --git a/tests/graphics/toolbarpalettes.py b/tests/graphics/toolbarpalettes.py
new file mode 100644
index 0000000..608ef57
--- /dev/null
+++ b/tests/graphics/toolbarpalettes.py
@@ -0,0 +1,65 @@
+# Copyright (C) 2007, Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Test palette positioning for toolbar and tray.
+"""
+
+import gtk
+
+from sugar.graphics.tray import HTray, TrayButton
+from sugar.graphics.toolbutton import ToolButton
+
+import common
+
+test = common.Test()
+
+vbox = gtk.VBox()
+
+theme_icons = gtk.icon_theme_get_default().list_icons()
+
+toolbar = gtk.Toolbar()
+vbox.pack_start(toolbar, False)
+toolbar.show()
+
+for i in range(0, 5):
+ button = ToolButton(icon_name=theme_icons[i])
+ button.set_tooltip('Icon %d' % i)
+ toolbar.insert(button, -1)
+ button.show()
+
+content = gtk.Label()
+vbox.pack_start(content)
+content.show()
+
+tray = HTray()
+vbox.pack_start(tray, False)
+tray.show()
+
+for i in range(0, 30):
+ button = TrayButton(icon_name=theme_icons[i])
+ button.set_tooltip('Icon %d' % i)
+ tray.add_item(button)
+ button.show()
+
+test.pack_start(vbox)
+vbox.show()
+
+test.show()
+
+if __name__ == "__main__":
+ common.main(test)
diff --git a/tests/graphics/tray.py b/tests/graphics/tray.py
new file mode 100644
index 0000000..f589f4e
--- /dev/null
+++ b/tests/graphics/tray.py
@@ -0,0 +1,82 @@
+# Copyright (C) 2007, Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Test the sugar.graphics.icon.Icon widget.
+"""
+
+import gtk
+
+from sugar.graphics.tray import HTray, VTray
+from sugar.graphics.tray import TrayButton, TrayIcon
+
+import common
+
+test = common.Test()
+
+vbox = gtk.VBox()
+
+tray = HTray()
+vbox.pack_start(tray, False)
+tray.show()
+
+theme_icons = gtk.icon_theme_get_default().list_icons()
+
+for i in range(0, 100):
+ button = TrayButton(icon_name=theme_icons[i])
+ tray.add_item(button)
+ button.show()
+
+tray = HTray()
+vbox.pack_start(tray, False)
+tray.show()
+
+for i in range(0, 10):
+ icon = TrayIcon(icon_name=theme_icons[i])
+ tray.add_item(icon)
+ icon.show()
+
+hbox = gtk.HBox()
+
+tray = VTray()
+hbox.pack_start(tray, False)
+tray.show()
+
+for i in range(0, 100):
+ button = TrayButton(icon_name=theme_icons[i])
+ tray.add_item(button)
+ button.show()
+
+tray = VTray()
+hbox.pack_start(tray, False)
+tray.show()
+
+for i in range(0, 4):
+ button = TrayButton(icon_name=theme_icons[i])
+ tray.add_item(button)
+ button.show()
+
+vbox.pack_start(hbox)
+hbox.show()
+
+test.pack_start(vbox)
+vbox.show()
+
+test.show()
+
+if __name__ == "__main__":
+ common.main(test)
diff --git a/tests/lib/runall.py b/tests/lib/runall.py
new file mode 100644
index 0000000..ae1bb3a
--- /dev/null
+++ b/tests/lib/runall.py
@@ -0,0 +1,28 @@
+# Copyright (C) 2007, Red Hat, Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+import unittest
+
+import test_mime
+
+runner = unittest.TextTestRunner()
+loader = unittest.TestLoader()
+
+suite = unittest.TestSuite()
+suite.addTest(loader.loadTestsFromModule(test_mime))
+
+runner.run(suite)
diff --git a/tests/lib/test_mime.py b/tests/lib/test_mime.py
new file mode 100644
index 0000000..3df0ce6
--- /dev/null
+++ b/tests/lib/test_mime.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2006, Red Hat, Inc.
+# Copyright (C) 2007, One Laptop Per Child
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+import sys
+import unittest
+
+from sugar import mime
+
+class TestMime(unittest.TestCase):
+ def test_from_file_name(self):
+ self.assertEqual(mime.get_from_file_name('test.pdf'),
+ 'application/pdf')
+
+ def test_choose_most_significant(self):
+ # Mozilla's text in dnd
+ mime_type = mime.choose_most_significant(
+ ['text/plain', 'text/_moz_htmlcontext', 'text/unicode',
+ 'text/html', 'text/_moz_htmlinfo'])
+ self.assertEqual(mime_type, 'text/html')
+
+ # Mozilla's text in c&v
+ mime_type = mime.choose_most_significant(
+ ['text/_moz_htmlcontext', 'STRING', 'text/html', 'text/_moz_htmlinfo',
+ 'text/x-moz-url-priv', 'UTF8_STRING', 'COMPOUND_TEXT'])
+ self.assertEqual(mime_type, 'text/html')
+
+ # Mozilla gif in dnd
+ mime_type = mime.choose_most_significant(
+ ['application/x-moz-file-promise-url',
+ 'application/x-moz-file-promise-dest-filename', 'text/_moz_htmlinfo',
+ 'text/x-moz-url-desc', 'text/_moz_htmlcontext', 'text/x-moz-url-data',
+ 'text/uri-list'])
+ self.assertEqual(mime_type, 'text/uri-list')
+
+ # Mozilla url in dnd
+ mime_type = mime.choose_most_significant(
+ ['text/_moz_htmlcontext', 'text/html', 'text/_moz_htmlinfo',
+ '_NETSCAPE_URL', 'text/x-moz-url', 'text/x-moz-url-desc',
+ 'text/x-moz-url-data', 'text/plain', 'text/unicode'])
+ self.assertEqual(mime_type, 'text/x-moz-url')
+
+ # Abiword text in dnd
+ mime_type = mime.choose_most_significant(
+ ['text/rtf', 'text/uri-list'])
+ self.assertEqual(mime_type, 'text/uri-list')
+
+ # Abiword text in c&v
+ mime_type = mime.choose_most_significant(
+ ['UTF8_STRING', 'STRING', 'text/html', 'TEXT', 'text/rtf',
+ 'COMPOUND_TEXT', 'application/rtf', 'text/plain',
+ 'application/xhtml+xml'])
+ self.assertEqual(mime_type, 'application/rtf')
+
+ # Abiword text in c&v
+ mime_type = mime.choose_most_significant(
+ ['GTK_TEXT_BUFFER_CONTENTS',
+ 'application/x-gtk-text-buffer-rich-text',
+ 'UTF8_STRING', 'COMPOUND_TEXT', 'TEXT', 'STRING',
+ 'text/plain;charset=utf-8', 'text/plain;charset=UTF-8',
+ 'text/plain'])
+ self.assertEqual(mime_type, 'text/plain')
+
+if __name__ == "__main__":
+ unittest.main()
+