def testAlternateSkeleton(self): dlg = rc.Dialog( StringIO('''IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75 STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "About" FONT 8, "System", 0, 0, 0x0 BEGIN LTEXT "Yipee skippy",IDC_STATIC,49,10,119,8, SS_NOPREFIX END '''), 'IDD_ABOUTBOX') dlg.Parse() alt_dlg = rc.Dialog( StringIO('''IDD_ABOUTBOX DIALOGEX 040704, 17, 230, 75 STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "XXXXXXXXX" FONT 8, "System", 0, 0, 0x0 BEGIN LTEXT "XXXXXXXXXXXXXXXXX",IDC_STATIC,110978,10,119,8, SS_NOPREFIX END '''), 'IDD_ABOUTBOX') alt_dlg.Parse() transl = dlg.Translate('en', skeleton_gatherer=alt_dlg) self.failUnless(transl.count('040704') and transl.count('110978')) self.failUnless(transl.count('Yipee skippy'))
def testDialog(self): dlg = rc.Dialog( StringIO('''IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75 STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU CAPTION "About" FONT 8, "System", 0, 0, 0x0 BEGIN ICON IDI_KLONK,IDC_MYICON,14,9,20,20 LTEXT "klonk Version ""yibbee"" 1.0",IDC_STATIC,49,10,119,8, SS_NOPREFIX LTEXT "Copyright (C) 2005",IDC_STATIC,49,20,119,8 DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP CONTROL "Jack ""Black"" Daniels",IDC_RADIO1,"Button", BS_AUTORADIOBUTTON,46,51,84,10 // try a line where the ID is on the continuation line LTEXT "blablablabla blablabla blablablablablablablabla blablabla", ID_SMURF, whatever... END '''), 'IDD_ABOUTBOX') dlg.Parse() self.failUnless(len(dlg.GetTextualIds()) == 7) self.failUnless(len(dlg.GetCliques()) == 6) self.failUnless(dlg.GetCliques()[1].GetMessage().GetRealContent() == 'klonk Version "yibbee" 1.0') transl = dlg.Translate('en') self.failUnless(transl.strip() == dlg.GetText().strip())
def testDialog(self): dlg = rc.Dialog( StringIO.StringIO('''\ IDD_SIDEBAR_RSS_PANEL_PROPPAGE DIALOGEX 0, 0, 239, 221 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN PUSHBUTTON "Add &URL",IDC_SIDEBAR_RSS_ADD_URL,182,53,57,14 EDITTEXT IDC_SIDEBAR_RSS_NEW_URL,0,53,178,15,ES_AUTOHSCROLL PUSHBUTTON "&Remove",IDC_SIDEBAR_RSS_REMOVE,183,200,56,14 PUSHBUTTON "&Edit",IDC_SIDEBAR_RSS_EDIT,123,200,56,14 CONTROL "&Automatically add commonly viewed clips", IDC_SIDEBAR_RSS_AUTO_ADD,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,0,200,120,17 PUSHBUTTON "",IDC_SIDEBAR_RSS_HIDDEN,179,208,6,6,NOT WS_VISIBLE LTEXT "You can display clips from blogs, news sites, and other online sources.", IDC_STATIC,0,0,239,10 LISTBOX IDC_SIDEBAR_DISPLAYED_FEED_LIST,0,69,239,127,LBS_SORT | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP LTEXT "Add a clip from a recently viewed website by clicking Add Recent Clips.", IDC_STATIC,0,13,141,19 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.", IDC_STATIC,0,33,239,18 PUSHBUTTON "Add Recent &Clips (10)...", IDC_SIDEBAR_RSS_ADD_RECENT_CLIPS,146,14,93,14 END'''), 'IDD_SIDEBAR_RSS_PANEL_PROPPAGE') dlg.SetUberClique(self.uq) dlg.Parse() warnings = shortcuts.GenerateDuplicateShortcutsWarnings( self.uq, 'PROJECT') self.failUnless(len(warnings) == 0)
def testRegressionEmptyString(self): dlg = rc.Dialog( StringIO('''\ IDD_CONFIRM_QUIT_GD_DLG DIALOGEX 0, 0, 267, 108 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION EXSTYLE WS_EX_TOPMOST CAPTION "Google Desktop" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN DEFPUSHBUTTON "&Yes",IDYES,82,87,50,14 PUSHBUTTON "&No",IDNO,136,87,50,14 ICON 32514,IDC_STATIC,7,9,21,20 EDITTEXT IDC_TEXTBOX,34,7,231,60,ES_MULTILINE | ES_READONLY | NOT WS_BORDER CONTROL "", IDC_ENABLE_GD_AUTOSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,33,70,231,10 END'''), 'IDD_CONFIRM_QUIT_GD_DLG') dlg.Parse() def Check(): self.failUnless(transl.count('IDC_ENABLE_GD_AUTOSTART')) self.failUnless(transl.count('END')) transl = dlg.Translate('de', pseudo_if_not_available=True, fallback_to_english=True) Check() transl = dlg.Translate('de', pseudo_if_not_available=True, fallback_to_english=False) Check() transl = dlg.Translate('de', pseudo_if_not_available=False, fallback_to_english=True) Check() transl = dlg.Translate('de', pseudo_if_not_available=False, fallback_to_english=False) Check() transl = dlg.Translate('en', pseudo_if_not_available=True, fallback_to_english=True) Check() transl = dlg.Translate('en', pseudo_if_not_available=True, fallback_to_english=False) Check() transl = dlg.Translate('en', pseudo_if_not_available=False, fallback_to_english=True) Check() transl = dlg.Translate('en', pseudo_if_not_available=False, fallback_to_english=False) Check()
def testRegressionDialogBox2(self): dialog = rc.Dialog(StringIO.StringIO(''' IDD_SIDEBAR_EMAIL_PANEL_PROPPAGE DIALOG DISCARDABLE 0, 0, 264, 220 STYLE WS_CHILD FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Email Filters",IDC_STATIC,7,3,250,190 LTEXT "Click Add Filter to create the email filter.",IDC_STATIC,16,41,130,9 PUSHBUTTON "Add Filter...",IDC_SIDEBAR_EMAIL_ADD_FILTER,196,38,50,14 PUSHBUTTON "Remove",IDC_SIDEBAR_EMAIL_REMOVE,196,174,50,14 PUSHBUTTON "", IDC_SIDEBAR_EMAIL_HIDDEN, 200, 178, 5, 5, NOT WS_VISIBLE LISTBOX IDC_SIDEBAR_EMAIL_LIST,16,60,230,108, LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP LTEXT "You can prevent certain emails from showing up in the sidebar with a filter.", IDC_STATIC,16,18,234,18 END'''.strip()), 'IDD_SIDEBAR_EMAIL_PANEL_PROPPAGE') dialog.Parse() self.failUnless('IDC_SIDEBAR_EMAIL_HIDDEN' in dialog.GetTextualIds())
def testRegressionDialogItemsTextOnly(self): dialog = rc.Dialog(StringIO.StringIO('''IDD_OPTIONS_SEARCH DIALOGEX 0, 0, 280, 292 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_DISABLED | WS_CAPTION | WS_SYSMENU CAPTION "Search" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN GROUPBOX "Select search buttons and options",-1,7,5,266,262 CONTROL "",IDC_OPTIONS,"SysTreeView32",TVS_DISABLEDRAGDROP | WS_BORDER | WS_TABSTOP | 0x800,16,19,248,218 LTEXT "Use Google site:",-1,26,248,52,8 COMBOBOX IDC_GOOGLE_HOME,87,245,177,256,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Restore Defaults...",IDC_RESET,187,272,86,14 END'''), 'IDD_OPTIONS_SEARCH') dialog.Parse() translateables = [c.GetMessage().GetRealContent() for c in dialog.GetCliques()] self.failUnless('Select search buttons and options' in translateables) self.failUnless('Use Google site:' in translateables)
def testRegressionDialogBox(self): dialog = rc.Dialog(StringIO.StringIO(''' IDD_SIDEBAR_WEATHER_PANEL_PROPPAGE DIALOGEX 0, 0, 205, 157 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN EDITTEXT IDC_SIDEBAR_WEATHER_NEW_CITY,3,27,112,14,ES_AUTOHSCROLL DEFPUSHBUTTON "Add Location",IDC_SIDEBAR_WEATHER_ADD,119,27,50,14 LISTBOX IDC_SIDEBAR_WEATHER_CURR_CITIES,3,48,127,89, LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP PUSHBUTTON "Move Up",IDC_SIDEBAR_WEATHER_MOVE_UP,134,104,50,14 PUSHBUTTON "Move Down",IDC_SIDEBAR_WEATHER_MOVE_DOWN,134,121,50,14 PUSHBUTTON "Remove",IDC_SIDEBAR_WEATHER_DELETE,134,48,50,14 LTEXT "To see current weather conditions and forecasts in the USA, enter the zip code (example: 94043) or city and state (example: Mountain View, CA).", IDC_STATIC,3,0,199,25 CONTROL "Fahrenheit",IDC_SIDEBAR_WEATHER_FAHRENHEIT,"Button", BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,3,144,51,10 CONTROL "Celsius",IDC_SIDEBAR_WEATHER_CELSIUS,"Button", BS_AUTORADIOBUTTON,57,144,38,10 END'''.strip()), 'IDD_SIDEBAR_WEATHER_PANEL_PROPPAGE') dialog.Parse() self.failUnless(len(dialog.GetTextualIds()) == 10)