コード例 #1
0
    def testByName(self):
        """" test retrieving actions and shortcuts by name """
        QSettings().clear()

        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName('shortcut2')
        action1 = QAction('action1', None)
        action2 = QAction('action2', None)

        s = QgsShortcutsManager(None)
        self.assertFalse(s.actionByName('action1'))
        self.assertFalse(s.shortcutByName('shortcut1'))

        s.registerShortcut(shortcut1)
        s.registerShortcut(shortcut2)
        s.registerAction(action1)
        s.registerAction(action2)

        self.assertEqual(s.shortcutByName('shortcut1'), shortcut1)
        self.assertFalse(s.shortcutByName('action1'))
        self.assertEqual(s.shortcutByName('shortcut2'), shortcut2)
        self.assertFalse(s.shortcutByName('action2'))
        self.assertFalse(s.actionByName('shortcut1'))
        self.assertEqual(s.actionByName('action1'), action1)
        self.assertFalse(s.actionByName('shortcut2'))
        self.assertEqual(s.actionByName('action2'), action2)
コード例 #2
0
    def testRegisterShortcut(self):
        """ test registering shortcuts """
        QSettings().clear()

        s = QgsShortcutsManager(None)

        shortcut1 = QShortcut(None)
        shortcut1.setKey('x')
        shortcut1.setObjectName('shortcut1')
        self.assertTrue(s.registerShortcut(shortcut1, 'A'))
        shortcut2 = QShortcut(None)
        shortcut2.setKey('y')
        shortcut2.setObjectName('shortcut2')
        self.assertTrue(s.registerShortcut(shortcut2, 'B'))

        # shortcuts should have been set to default sequences
        self.assertEqual(shortcut1.key().toString(), 'A')
        self.assertEqual(shortcut2.key().toString(), 'B')

        # test that adding a shortcut should set its sequence automatically
        s.setKeySequence(shortcut1, 'C')
        s.setKeySequence(shortcut2, 'D')

        s = QgsShortcutsManager(None)
        self.assertTrue(s.registerShortcut(shortcut1, 'A'))
        self.assertTrue(s.registerShortcut(shortcut2, 'B'))

        # shortcuts should have been set to previous sequences
        self.assertEqual(shortcut1.key().toString(), 'C')
        self.assertEqual(shortcut2.key().toString(), 'D')
コード例 #3
0
    def testRegisterShortcut(self):
        """ test registering shortcuts """
        QSettings().clear()

        s = QgsShortcutsManager(None)

        shortcut1 = QShortcut(None)
        shortcut1.setKey("x")
        shortcut1.setObjectName("shortcut1")
        self.assertTrue(s.registerShortcut(shortcut1, "A"))
        shortcut2 = QShortcut(None)
        shortcut2.setKey("y")
        shortcut2.setObjectName("shortcut2")
        self.assertTrue(s.registerShortcut(shortcut2, "B"))

        # shortcuts should have been set to default sequences
        self.assertEqual(shortcut1.key().toString(), "A")
        self.assertEqual(shortcut2.key().toString(), "B")

        # test that adding a shortcut should set its sequence automatically
        s.setKeySequence(shortcut1, "C")
        s.setKeySequence(shortcut2, "D")

        s = QgsShortcutsManager(None)
        self.assertTrue(s.registerShortcut(shortcut1, "A"))
        self.assertTrue(s.registerShortcut(shortcut2, "B"))

        # shortcuts should have been set to previous sequences
        self.assertEqual(shortcut1.key().toString(), "C")
        self.assertEqual(shortcut2.key().toString(), "D")
コード例 #4
0
    def testUnregister(self):
        """ test unregistering from manager """

        QSettings().clear()

        s = QgsShortcutsManager(None)

        shortcut1 = QShortcut(None)
        shortcut1.setKey('x')
        shortcut1.setObjectName('shortcut1')
        shortcut2 = QShortcut(None)
        shortcut2.setKey('y')
        shortcut2.setObjectName('shortcut2')

        action1 = QAction('action1', None)
        action1.setShortcut('x')
        action2 = QAction('action2', None)
        action2.setShortcut('y')

        # try unregistering objects not registered in manager
        self.assertFalse(s.unregisterShortcut(shortcut1))
        self.assertFalse(s.unregisterAction(action1))

        # try unregistering objects from manager
        s.registerShortcut(shortcut1)
        s.registerShortcut(shortcut2)
        s.registerAction(action1)
        s.registerAction(action2)

        self.assertEqual(set(s.listActions()), set([action1, action2]))
        self.assertEqual(set(s.listShortcuts()), set([shortcut1, shortcut2]))

        self.assertTrue(s.unregisterAction(action1))
        self.assertTrue(s.unregisterShortcut(shortcut1))

        self.assertEqual(set(s.listActions()), set([action2]))
        self.assertEqual(set(s.listShortcuts()), set([shortcut2]))

        self.assertTrue(s.unregisterAction(action2))
        self.assertTrue(s.unregisterShortcut(shortcut2))
コード例 #5
0
    def testBySequence(self):
        """ test retrieving by sequence """
        QSettings().clear()

        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName('shortcut2')
        action1 = QAction('action1', None)
        action2 = QAction('action2', None)

        s = QgsShortcutsManager(None)
        self.assertFalse(s.actionForSequence('E'))
        self.assertFalse(s.objectForSequence('F'))

        s.registerShortcut(shortcut1, 'E')
        s.registerShortcut(shortcut2, 'A')
        s.registerAction(action1, 'F')
        s.registerAction(action2, 'B')
        # use another way of registering sequences
        self.assertTrue(s.setKeySequence(shortcut2, 'G'))
        self.assertTrue(s.setKeySequence(action2, 'H'))

        self.assertEqual(s.objectForSequence('E'), shortcut1)
        self.assertEqual(s.objectForSequence('F'), action1)
        self.assertEqual(s.objectForSequence('G'), shortcut2)
        self.assertEqual(s.objectForSequence('H'), action2)
        self.assertFalse(s.objectForSequence('A'))
        self.assertFalse(s.objectForSequence('B'))

        self.assertEqual(s.shortcutForSequence('E'), shortcut1)
        self.assertFalse(s.shortcutForSequence('F'))
        self.assertEqual(s.shortcutForSequence('G'), shortcut2)
        self.assertFalse(s.shortcutForSequence('H'))
        self.assertFalse(s.actionForSequence('E'))
        self.assertEqual(s.actionForSequence('F'), action1)
        self.assertFalse(s.actionForSequence('G'))
        self.assertEqual(s.actionForSequence('H'), action2)
コード例 #6
0
    def testBySequence(self):
        """ test retrieving by sequence """
        QgsSettings().clear()

        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName('shortcut2')
        action1 = QAction('action1', None)
        action2 = QAction('action2', None)

        s = QgsShortcutsManager(None)
        self.assertFalse(s.actionForSequence('E'))
        self.assertFalse(s.objectForSequence('F'))

        s.registerShortcut(shortcut1, 'E')
        s.registerShortcut(shortcut2, 'A')
        s.registerAction(action1, 'F')
        s.registerAction(action2, 'B')
        # use another way of registering sequences
        self.assertTrue(s.setKeySequence(shortcut2, 'G'))
        self.assertTrue(s.setKeySequence(action2, 'H'))

        self.assertEqual(s.objectForSequence('E'), shortcut1)
        self.assertEqual(s.objectForSequence('F'), action1)
        self.assertEqual(s.objectForSequence('G'), shortcut2)
        self.assertEqual(s.objectForSequence('H'), action2)
        self.assertFalse(s.objectForSequence('A'))
        self.assertFalse(s.objectForSequence('B'))

        self.assertEqual(s.shortcutForSequence('E'), shortcut1)
        self.assertFalse(s.shortcutForSequence('F'))
        self.assertEqual(s.shortcutForSequence('G'), shortcut2)
        self.assertFalse(s.shortcutForSequence('H'))
        self.assertFalse(s.actionForSequence('E'))
        self.assertEqual(s.actionForSequence('F'), action1)
        self.assertFalse(s.actionForSequence('G'))
        self.assertEqual(s.actionForSequence('H'), action2)
コード例 #7
0
    def testBySequence(self):
        """ test retrieving by sequence """
        QSettings().clear()

        shortcut1 = QShortcut(None)
        shortcut1.setObjectName("shortcut1")
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName("shortcut2")
        action1 = QAction("action1", None)
        action2 = QAction("action2", None)

        s = QgsShortcutsManager(None)
        self.assertFalse(s.actionForSequence("E"))
        self.assertFalse(s.objectForSequence("F"))

        s.registerShortcut(shortcut1, "E")
        s.registerShortcut(shortcut2, "A")
        s.registerAction(action1, "F")
        s.registerAction(action2, "B")
        # use another way of registering sequences
        self.assertTrue(s.setKeySequence(shortcut2, "G"))
        self.assertTrue(s.setKeySequence(action2, "H"))

        self.assertEqual(s.objectForSequence("E"), shortcut1)
        self.assertEqual(s.objectForSequence("F"), action1)
        self.assertEqual(s.objectForSequence("G"), shortcut2)
        self.assertEqual(s.objectForSequence("H"), action2)
        self.assertFalse(s.objectForSequence("A"))
        self.assertFalse(s.objectForSequence("B"))

        self.assertEqual(s.shortcutForSequence("E"), shortcut1)
        self.assertFalse(s.shortcutForSequence("F"))
        self.assertEqual(s.shortcutForSequence("G"), shortcut2)
        self.assertFalse(s.shortcutForSequence("H"))
        self.assertFalse(s.actionForSequence("E"))
        self.assertEqual(s.actionForSequence("F"), action1)
        self.assertFalse(s.actionForSequence("G"))
        self.assertEqual(s.actionForSequence("H"), action2)
コード例 #8
0
    def testRegisterAll(self):
        """ test registering all children """

        w = QWidget()
        action1 = QAction('action1', w)
        shortcut1 = QShortcut(w)
        shortcut1.setObjectName('shortcut1')
        w2 = QWidget(w)
        action2 = QAction('action2', w2)
        shortcut2 = QShortcut(w2)
        shortcut2.setObjectName('shortcut2')

        # recursive
        s = QgsShortcutsManager()
        s.registerAllChildActions(w, True)
        self.assertEqual(set(s.listActions()), set([action1, action2]))
        s.registerAllChildShortcuts(w, True)
        self.assertEqual(set(s.listShortcuts()), set([shortcut1, shortcut2]))

        # non recursive
        s = QgsShortcutsManager()
        s.registerAllChildActions(w, False)
        self.assertEqual(set(s.listActions()), set([action1]))
        s.registerAllChildShortcuts(w, False)
        self.assertEqual(set(s.listShortcuts()), set([shortcut1]))

        # recursive
        s = QgsShortcutsManager()
        s.registerAllChildren(w, True)
        self.assertEqual(set(s.listActions()), set([action1, action2]))
        self.assertEqual(set(s.listShortcuts()), set([shortcut1, shortcut2]))

        # non recursive
        s = QgsShortcutsManager()
        s.registerAllChildren(w, False)
        self.assertEqual(set(s.listActions()), set([action1]))
        self.assertEqual(set(s.listShortcuts()), set([shortcut1]))
コード例 #9
0
    def testRegisterAll(self):
        """ test registering all children """

        w = QWidget()
        action1 = QAction('action1', w)
        shortcut1 = QShortcut(w)
        shortcut1.setObjectName('shortcut1')
        w2 = QWidget(w)
        action2 = QAction('action2', w2)
        shortcut2 = QShortcut(w2)
        shortcut2.setObjectName('shortcut2')

        # recursive
        s = QgsShortcutsManager()
        s.registerAllChildActions(w, True)
        self.assertEqual(set(s.listActions()), set([action1, action2]))
        s.registerAllChildShortcuts(w, True)
        self.assertEqual(set(s.listShortcuts()), set([shortcut1, shortcut2]))

        # non recursive
        s = QgsShortcutsManager()
        s.registerAllChildActions(w, False)
        self.assertEqual(set(s.listActions()), set([action1]))
        s.registerAllChildShortcuts(w, False)
        self.assertEqual(set(s.listShortcuts()), set([shortcut1]))

        # recursive
        s = QgsShortcutsManager()
        s.registerAllChildren(w, True)
        self.assertEqual(set(s.listActions()), set([action1, action2]))
        self.assertEqual(set(s.listShortcuts()), set([shortcut1, shortcut2]))

        # non recursive
        s = QgsShortcutsManager()
        s.registerAllChildren(w, False)
        self.assertEqual(set(s.listActions()), set([action1]))
        self.assertEqual(set(s.listShortcuts()), set([shortcut1]))
コード例 #10
0
    def testSetSequence(self):
        """ test setting key sequences """

        QgsSettings().clear()

        s = QgsShortcutsManager(None)

        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName('shortcut2')
        action1 = QAction('action1', None)
        action2 = QAction('action2', None)

        s.registerShortcut(shortcut1, 'A')
        s.registerShortcut(shortcut2, 'B')
        s.registerAction(action1, 'C')
        s.registerAction(action2, 'D')

        # test setting by action/shortcut
        self.assertTrue(s.setKeySequence(shortcut1, 'E'))
        self.assertTrue(s.setKeySequence(shortcut2, 'F'))
        self.assertTrue(s.setKeySequence(action1, 'G'))
        self.assertTrue(s.setKeySequence(action2, 'H'))

        # test that action/shortcuts have been updated
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(shortcut2.key().toString(), 'F')
        self.assertEqual(action1.shortcut().toString(), 'G')
        self.assertEqual(action2.shortcut().toString(), 'H')

        # new manager
        s = QgsShortcutsManager(None)
        # new shortcuts
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName('shortcut2')
        action1 = QAction('action1', None)
        action2 = QAction('action2', None)

        # register them
        s.registerShortcut(shortcut1, 'A')
        s.registerShortcut(shortcut2, 'B')
        s.registerAction(action1, 'C')
        s.registerAction(action2, 'D')

        # check that previously set sequence has been restored
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(shortcut2.key().toString(), 'F')
        self.assertEqual(action1.shortcut().toString(), 'G')
        self.assertEqual(action2.shortcut().toString(), 'H')

        # same test, using setObjectKeySequence
        QgsSettings().clear()
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        action1 = QAction('action1', None)
        s.registerShortcut(shortcut1, 'A')
        s.registerAction(action1, 'C')
        self.assertTrue(s.setObjectKeySequence(shortcut1, 'E'))
        self.assertTrue(s.setObjectKeySequence(action1, 'G'))
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(action1.shortcut().toString(), 'G')
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        action1 = QAction('action1', None)
        s.registerShortcut(shortcut1, 'A')
        s.registerAction(action1, 'C')
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(action1.shortcut().toString(), 'G')

        # same test, using setKeySequence by name
        QgsSettings().clear()
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        action1 = QAction('action1', None)
        s.registerShortcut(shortcut1, 'A')
        s.registerAction(action1, 'C')
        self.assertFalse(s.setKeySequence('invalid_name', 'E'))
        self.assertTrue(s.setKeySequence('shortcut1', 'E'))
        self.assertTrue(s.setKeySequence('action1', 'G'))
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(action1.shortcut().toString(), 'G')
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        action1 = QAction('action1', None)
        s.registerShortcut(shortcut1, 'A')
        s.registerAction(action1, 'C')
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(action1.shortcut().toString(), 'G')
コード例 #11
0
    def testSetSequence(self):
        """ test setting key sequences """

        QSettings().clear()

        s = QgsShortcutsManager(None)

        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName('shortcut2')
        action1 = QAction('action1', None)
        action2 = QAction('action2', None)

        s.registerShortcut(shortcut1, 'A')
        s.registerShortcut(shortcut2, 'B')
        s.registerAction(action1, 'C')
        s.registerAction(action2, 'D')

        # test setting by action/shortcut
        self.assertTrue(s.setKeySequence(shortcut1, 'E'))
        self.assertTrue(s.setKeySequence(shortcut2, 'F'))
        self.assertTrue(s.setKeySequence(action1, 'G'))
        self.assertTrue(s.setKeySequence(action2, 'H'))

        # test that action/shortcuts have been updated
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(shortcut2.key().toString(), 'F')
        self.assertEqual(action1.shortcut().toString(), 'G')
        self.assertEqual(action2.shortcut().toString(), 'H')

        # new manager
        s = QgsShortcutsManager(None)
        # new shortcuts
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName('shortcut2')
        action1 = QAction('action1', None)
        action2 = QAction('action2', None)

        # register them
        s.registerShortcut(shortcut1, 'A')
        s.registerShortcut(shortcut2, 'B')
        s.registerAction(action1, 'C')
        s.registerAction(action2, 'D')

        # check that previously set sequence has been restored
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(shortcut2.key().toString(), 'F')
        self.assertEqual(action1.shortcut().toString(), 'G')
        self.assertEqual(action2.shortcut().toString(), 'H')

        # same test, using setObjectKeySequence
        QSettings().clear()
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        action1 = QAction('action1', None)
        s.registerShortcut(shortcut1, 'A')
        s.registerAction(action1, 'C')
        self.assertTrue(s.setObjectKeySequence(shortcut1, 'E'))
        self.assertTrue(s.setObjectKeySequence(action1, 'G'))
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(action1.shortcut().toString(), 'G')
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        action1 = QAction('action1', None)
        s.registerShortcut(shortcut1, 'A')
        s.registerAction(action1, 'C')
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(action1.shortcut().toString(), 'G')

        # same test, using setKeySequence by name
        QSettings().clear()
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        action1 = QAction('action1', None)
        s.registerShortcut(shortcut1, 'A')
        s.registerAction(action1, 'C')
        self.assertFalse(s.setKeySequence('invalid_name', 'E'))
        self.assertTrue(s.setKeySequence('shortcut1', 'E'))
        self.assertTrue(s.setKeySequence('action1', 'G'))
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(action1.shortcut().toString(), 'G')
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName('shortcut1')
        action1 = QAction('action1', None)
        s.registerShortcut(shortcut1, 'A')
        s.registerAction(action1, 'C')
        self.assertEqual(shortcut1.key().toString(), 'E')
        self.assertEqual(action1.shortcut().toString(), 'G')
コード例 #12
0
    def testSetSequence(self):
        """ test setting key sequences """

        QSettings().clear()

        s = QgsShortcutsManager(None)

        shortcut1 = QShortcut(None)
        shortcut1.setObjectName("shortcut1")
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName("shortcut2")
        action1 = QAction("action1", None)
        action2 = QAction("action2", None)

        s.registerShortcut(shortcut1, "A")
        s.registerShortcut(shortcut2, "B")
        s.registerAction(action1, "C")
        s.registerAction(action2, "D")

        # test setting by action/shortcut
        self.assertTrue(s.setKeySequence(shortcut1, "E"))
        self.assertTrue(s.setKeySequence(shortcut2, "F"))
        self.assertTrue(s.setKeySequence(action1, "G"))
        self.assertTrue(s.setKeySequence(action2, "H"))

        # test that action/shortcuts have been updated
        self.assertEqual(shortcut1.key().toString(), "E")
        self.assertEqual(shortcut2.key().toString(), "F")
        self.assertEqual(action1.shortcut().toString(), "G")
        self.assertEqual(action2.shortcut().toString(), "H")

        # new manager
        s = QgsShortcutsManager(None)
        # new shortcuts
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName("shortcut1")
        shortcut2 = QShortcut(None)
        shortcut2.setObjectName("shortcut2")
        action1 = QAction("action1", None)
        action2 = QAction("action2", None)

        # register them
        s.registerShortcut(shortcut1, "A")
        s.registerShortcut(shortcut2, "B")
        s.registerAction(action1, "C")
        s.registerAction(action2, "D")

        # check that previously set sequence has been restored
        self.assertEqual(shortcut1.key().toString(), "E")
        self.assertEqual(shortcut2.key().toString(), "F")
        self.assertEqual(action1.shortcut().toString(), "G")
        self.assertEqual(action2.shortcut().toString(), "H")

        # same test, using setObjectKeySequence
        QSettings().clear()
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName("shortcut1")
        action1 = QAction("action1", None)
        s.registerShortcut(shortcut1, "A")
        s.registerAction(action1, "C")
        self.assertTrue(s.setObjectKeySequence(shortcut1, "E"))
        self.assertTrue(s.setObjectKeySequence(action1, "G"))
        self.assertEqual(shortcut1.key().toString(), "E")
        self.assertEqual(action1.shortcut().toString(), "G")
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName("shortcut1")
        action1 = QAction("action1", None)
        s.registerShortcut(shortcut1, "A")
        s.registerAction(action1, "C")
        self.assertEqual(shortcut1.key().toString(), "E")
        self.assertEqual(action1.shortcut().toString(), "G")

        # same test, using setKeySequence by name
        QSettings().clear()
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName("shortcut1")
        action1 = QAction("action1", None)
        s.registerShortcut(shortcut1, "A")
        s.registerAction(action1, "C")
        self.assertFalse(s.setKeySequence("invalid_name", "E"))
        self.assertTrue(s.setKeySequence("shortcut1", "E"))
        self.assertTrue(s.setKeySequence("action1", "G"))
        self.assertEqual(shortcut1.key().toString(), "E")
        self.assertEqual(action1.shortcut().toString(), "G")
        s = QgsShortcutsManager(None)
        shortcut1 = QShortcut(None)
        shortcut1.setObjectName("shortcut1")
        action1 = QAction("action1", None)
        s.registerShortcut(shortcut1, "A")
        s.registerAction(action1, "C")
        self.assertEqual(shortcut1.key().toString(), "E")
        self.assertEqual(action1.shortcut().toString(), "G")