Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(687)

Side by Side Diff: grit/shortcuts_unittests.py

Issue 7994004: Initial source commit to grit-i18n project. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « grit/shortcuts.py ('k') | grit/tclib.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #!/usr/bin/python2.4
2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 '''Unit tests for grit.shortcuts
7 '''
8
9 import os
10 import sys
11 if __name__ == '__main__':
12 sys.path.append(os.path.join(os.path.dirname(sys.argv[0]), '..'))
13
14 import unittest
15
16 from grit import shortcuts
17 from grit import clique
18 from grit import tclib
19 from grit.gather import rc
20
21 class ShortcutsUnittest(unittest.TestCase):
22
23 def setUp(self):
24 self.uq = clique.UberClique()
25
26 def testFunctionality(self):
27 c = self.uq.MakeClique(tclib.Message(text="Hello &there"))
28 c.AddToShortcutGroup('group_name')
29 c = self.uq.MakeClique(tclib.Message(text="Howdie &there partner"))
30 c.AddToShortcutGroup('group_name')
31
32 warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
33 self.failUnless(warnings)
34
35 def testAmpersandEscaping(self):
36 c = self.uq.MakeClique(tclib.Message(text="Hello &there"))
37 c.AddToShortcutGroup('group_name')
38 c = self.uq.MakeClique(tclib.Message(text="S&&T are the &letters S and T"))
39 c.AddToShortcutGroup('group_name')
40
41 warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
42 self.failUnless(len(warnings) == 0)
43
44 def testDialog(self):
45 dlg = rc.Dialog('''\
46 IDD_SIDEBAR_RSS_PANEL_PROPPAGE DIALOGEX 0, 0, 239, 221
47 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
48 FONT 8, "MS Shell Dlg", 400, 0, 0x1
49 BEGIN
50 PUSHBUTTON "Add &URL",IDC_SIDEBAR_RSS_ADD_URL,182,53,57,14
51 EDITTEXT IDC_SIDEBAR_RSS_NEW_URL,0,53,178,15,ES_AUTOHSCROLL
52 PUSHBUTTON "&Remove",IDC_SIDEBAR_RSS_REMOVE,183,200,56,14
53 PUSHBUTTON "&Edit",IDC_SIDEBAR_RSS_EDIT,123,200,56,14
54 CONTROL "&Automatically add commonly viewed clips",
55 IDC_SIDEBAR_RSS_AUTO_ADD,"Button",BS_AUTOCHECKBOX |
56 BS_MULTILINE | WS_TABSTOP,0,200,120,17
57 PUSHBUTTON "",IDC_SIDEBAR_RSS_HIDDEN,179,208,6,6,NOT WS_VISIBLE
58 LTEXT "You can display clips from blogs, news sites, and other onl ine sources.",
59 IDC_STATIC,0,0,239,10
60 LISTBOX IDC_SIDEBAR_DISPLAYED_FEED_LIST,0,69,239,127,LBS_SORT |
61 LBS_OWNERDRAWFIXED | LBS_HASSTRINGS |
62 LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL |
63 WS_TABSTOP
64 LTEXT "Add a clip from a recently viewed website by clicking Add R ecent Clips.",
65 IDC_STATIC,0,13,141,19
66 LTEXT "Or, if you know a site supports RSS or Atom, you can enter the RSS or Atom URL below and add it to your list of Web Clips.",
67 IDC_STATIC,0,33,239,18
68 PUSHBUTTON "Add Recent &Clips (10)...",
69 IDC_SIDEBAR_RSS_ADD_RECENT_CLIPS,146,14,93,14
70 END''')
71 dlg.SetUberClique(self.uq)
72 dlg.Parse()
73
74 warnings = shortcuts.GenerateDuplicateShortcutsWarnings(self.uq, 'PROJECT')
75 self.failUnless(len(warnings) == 0)
76
77 if __name__ == '__main__':
78 unittest.main()
79
OLDNEW
« no previous file with comments | « grit/shortcuts.py ('k') | grit/tclib.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698