Title: [commits] (capps) [11140] Bug 5879: Fixes functional and performance tests for switching timezones
Revision
11140
Author
capps
Date
2006-07-12 16:30:53 -0700 (Wed, 12 Jul 2006)

Log Message

Bug 5879: Fixes functional and performance tests for switching timezones
- tested on xp and osx, not yet enabled
- TestSwitchTimezone now uses "canonicalTimeZone" when finding the default
- both SwitchTimezone tests now use app_ns() appropriately
- removed second test (?!) found at the end of the perf test
- also tweaked TestEnableTimezones to fix a gaffe

Modified Paths

Diff

Modified: trunk/chandler/tools/QATestScripts/Functional/TestEnableTimezones.py (11139 => 11140)

--- trunk/chandler/tools/QATestScripts/Functional/TestEnableTimezones.py	2006-07-12 23:14:53 UTC (rev 11139)
+++ trunk/chandler/tools/QATestScripts/Functional/TestEnableTimezones.py	2006-07-12 23:30:53 UTC (rev 11140)
@@ -15,13 +15,12 @@
 import tools.QAUITestAppLib as QAUITestAppLib
 
 #initialization
-fileName = "TestEnableTimezones.log"
-logger = QAUITestAppLib.QALogger(fileName, "TestEnableTimezones")
+logger = QAUITestAppLib.QALogger("TestEnableTimezones.log",
+                                 "TestEnableTimezones")
 
 def testEnabled(event, calendarBlock, logger):
     # Test that the detail view does display the timezone
-    global floatingEvent
-    floatingEvent.CheckDisplayedValues(EditTimeZone=(True, 'Floating'))
+    event.CheckDisplayedValues(EditTimeZone=(True, 'Floating'))
 
     # Test that the calendar view does display the timezone widget
     if calendarBlock.widget.tzChoice.IsShown():

Modified: trunk/chandler/tools/QATestScripts/Functional/TestSwitchTimezone.py (11139 => 11140)

--- trunk/chandler/tools/QATestScripts/Functional/TestSwitchTimezone.py	2006-07-12 23:14:53 UTC (rev 11139)
+++ trunk/chandler/tools/QATestScripts/Functional/TestSwitchTimezone.py	2006-07-12 23:30:53 UTC (rev 11140)
@@ -15,19 +15,21 @@
 import tools.QAUITestAppLib as QAUITestAppLib
 
 from PyICU import ICUtzinfo
+from osaf.pim.calendar.TimeZone import TimeZoneInfo
 
-fileName = "TestSwitchTimezone.log"
-logger = QAUITestAppLib.QALogger(fileName, "Switch timezone")
+logger = QAUITestAppLib.QALogger("TestSwitchTimezone.log",
+                                 "TestSwitchTimezone")
 
-originalTz = ICUtzinfo.default.tzid
-switchTz = "US/Hawaii"
-
 try:
-    app_ns = app_ns()
-    calendarBlock = getattr(app_ns, "MainCalendarControl")
+    calendarBlock = getattr(app_ns(), "MainCalendarControl")
 
+    # Find the "canonical timezone" to use in test comparisons
+    info = TimeZoneInfo.get(app_ns().itsView)
+    originalTz = info.canonicalTimeZone(ICUtzinfo.default).tzid
+    switchTz = "US/Hawaii"
+
     # Enable timezones so that we can switch from the UI
-    app_ns.root.EnableTimezones()
+    app_ns().root.EnableTimezones()
 
     # Create a new event, which should inherit the default tz 
     timezoneEvent = QAUITestAppLib.UITestItem("Event", logger)

Modified: trunk/chandler/tools/QATestScripts/Performance/xPerfLargeDataSwitchTimezone.py (11139 => 11140)

--- trunk/chandler/tools/QATestScripts/Performance/xPerfLargeDataSwitchTimezone.py	2006-07-12 23:14:53 UTC (rev 11139)
+++ trunk/chandler/tools/QATestScripts/Performance/xPerfLargeDataSwitchTimezone.py	2006-07-12 23:30:53 UTC (rev 11140)
@@ -17,23 +17,24 @@
 from datetime import datetime
 from PyICU import ICUtzinfo
 
-fileName = "PerfLargeDataSwitchTimezone.log"
-logger = QAUITestAppLib.QALogger(fileName, "Switch timezone")
+logger = QAUITestAppLib.QALogger("PerfLargeDataSwitchTimezone.log",
+                                 "PerfLargeDataSwitchTimezone")
 
 try:
-    app_ns = app_ns()
-    calendarBlock = getattr(app_ns, "MainCalendarControl")
+    calendarBlock = getattr(app_ns(), "MainCalendarControl")
 
     # Enable timezones so that we can switch from the UI
-    app_ns.root.EnableTimezones()
+    app_ns().root.EnableTimezones()
     
     # Start at the same date every time
     testdate = datetime(2005, 11, 27, tzinfo=ICUtzinfo.default)
-    app_ns.root.SelectedDateChanged(start=testdate)
+    app_ns().root.SelectedDateChanged(start=testdate)
 
     # Load a large calendar
-    testView = QAUITestAppLib.UITestView(logger, "office.ics")#, u'Generated3000.ics')
-    app_ns.sidebar.select(testView.collection)
+    testView = QAUITestAppLib.UITestView(logger)#, u'Generated3000.ics')
+    clickSucceeded = User.emulate_sidebarClick(app_ns().sidebar,
+                                               "Generated3000",
+                                               overlay=False)
     User.idle()
 
     # Switch the timezone (this is the action we are measuring)
@@ -50,55 +51,16 @@
         logger.ReportPass("Timezone switched")
     else:
         logger.ReportFailure("Timezone failed to switch")
-    
-    logger.SetChecked(True)
-    logger.Report("Switch timezone")
 
-finally:
-    logger.Close()
-    
-import tools.QAUITestAppLib as QAUITestAppLib
-
-from datetime import datetime
-from PyICU import ICUtzinfo
-
-fileName = "PerfLargeDataSwitchTimezone.log"
-logger = QAUITestAppLib.QALogger(fileName, "Switch timezone")
-
-try:
-    app_ns = app_ns()
-    calendarBlock = getattr(app_ns, "MainCalendarControl")
-
-    # Enable timezones so that we can switch from the UI
-    app_ns.root.EnableTimezones()
-    
-    # Start at the same date every time
-    testdate = datetime(2005, 11, 27, tzinfo=ICUtzinfo.default)
-    app_ns.root.SelectedDateChanged(start=testdate)
-
-    # Load a large calendar
-    testView = QAUITestAppLib.UITestView(logger, "office.ics")#, u'Generated3000.ics')
-    app_ns.sidebar.select(testView.collection)
-    User.idle()
-
-    # Switch the timezone (this is the action we are measuring)
-    logger.Start("Switch timezone to US/Hawaii")
-    QAUITestAppLib.SetChoice(calendarBlock.widget.tzChoice, "US/Hawaii")
-    User.idle()
-    logger.Stop()
-
-    # Verification
-
-    # @@@ KCP this test could be improved
-    # Currently tests that the default tz is now US/Hawaii
-    if ICUtzinfo.default == ICUtzinfo.getInstance("US/Hawaii"):
-        logger.ReportPass("Timezone switched")
+    if clickSucceeded:
+        logger.ReportPass("Selected large data calendar")
     else:
-        logger.ReportFailure("Timezone failed to switch")
+        logger.ReportFailure("Failed to select large data calendar")
     
     logger.SetChecked(True)
     logger.Report("Switch timezone")
 
 finally:
     logger.Close()
+
     




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to