test_uimanager.py :  » IDE » PIDA » pida-0.6beta3 » tests » ui » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » IDE » PIDA 
PIDA » pida 0.6beta3 » tests » ui » test_uimanager.py

from unittest import TestCase

import gtk

from pida.utils.testing import refresh_gui

from pida.ui.uimanager import PidaUIManager

class UIMSetupTestCase(TestCase):

    def setUp(self):
        self.uim = PidaUIManager()
        refresh_gui()

    def test_base_xml(self):
        self.assert_('main_menu' in self.uim._uim.get_ui())
        self.assert_('main_toolbar' in self.uim._uim.get_ui())

    def test_menu_file(self):
        self.assert_('FileMenu' in self.uim._uim.get_ui())

    def test_menu_edit(self):
        self.assert_('EditMenu' in self.uim._uim.get_ui())
    
    def test_menu_project(self):
        self.assert_('ProjectMenu' in self.uim._uim.get_ui())
    
    def test_menu_tools(self):
        self.assert_('ToolsMenu' in self.uim._uim.get_ui())
    
    def test_menu_view(self):
        self.assert_('ViewMenu' in self.uim._uim.get_ui())
    
    def test_menu_help(self):
        self.assert_('HelpMenu' in self.uim._uim.get_ui())

    def test_menu_actions_file(self):
        a = [a.get_name() for a in self.uim._base_ag.list_actions()]
        self.assert_('FileMenu' in a)

    def test_menu_actions_edit(self):
        a = [a.get_name() for a in self.uim._base_ag.list_actions()]
        self.assert_('EditMenu' in a)

    def test_menu_actions_project(self):
        a = [a.get_name() for a in self.uim._base_ag.list_actions()]
        self.assert_('ProjectMenu' in a)

    def test_menu_actions_language(self):
        a = [a.get_name() for a in self.uim._base_ag.list_actions()]
        self.assert_('LanguageMenu' in a)

    def test_menu_actions_tools(self):
        a = [a.get_name() for a in self.uim._base_ag.list_actions()]
        self.assert_('ToolsMenu' in a)

    def test_menu_actions_view(self):
        a = [a.get_name() for a in self.uim._base_ag.list_actions()]
        self.assert_('ViewMenu' in a)

    def test_menu_actions_help(self):
        a = [a.get_name() for a in self.uim._base_ag.list_actions()]
        self.assert_('HelpMenu' in a)

    def test_menubar(self):
        menubar = self.uim.get_menubar()
        refresh_gui()
        self.assert_(isinstance(menubar, gtk.MenuBar))
        [self.assert_(isinstance(m, gtk.MenuItem)) for m in menubar.get_children()]

    def test_toolbar(self):
        toolbar = self.uim.get_toolbar()
        refresh_gui()

    def test_add_ui(self):
        ag = gtk.ActionGroup(name='myacts')
        ag.add_actions(
            [
                ('MyMenu', None, 'MyMenu', None, None),
            ]
        )
        self.uim.add_action_group(ag)
        self.uim.add_ui_from_string(
            """<menubar name="main_menubar">
                <menu name="FileMenu" action="FileMenu">
                    <menuitem action="MyMenu" />
                </menu>
            </menubar>"""
        )
        refresh_gui()
        menubar = self.uim.get_menubar()
        fm = menubar.get_children()[0]
        acts = [m.get_action().get_name() for m in fm.get_submenu() if m.get_action() is not None]
        self.assert_('MyMenu' in acts)


www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.