Bugzilla – Attachment 99582 Details for
Bug 63230
Calc: Date decreased by 1 depending on Timezone
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
Script to look for similar bug.
tztest.py (text/x-python), 4.95 KB, created by
Isamu Mogi
on 2014-05-22 12:33:07 UTC
(
hide
)
Description:
Script to look for similar bug.
Filename:
MIME Type:
Creator:
Isamu Mogi
Created:
2014-05-22 12:33:07 UTC
Size:
4.95 KB
patch
obsolete
>import uno >import unohelper >import atexit >import os >import signal >import datetime >import signal >import sys >import re >from pprint import pprint >from time import sleep >from subprocess import Popen >from com.sun.star.script.provider import XScriptContext >from com.sun.star.connection import NoConnectException >from com.sun.star.util import Date >from com.sun.star.beans import PropertyValue > >officePath = sys.argv[1] if len(sys.argv) > 1 else "soffice" >startYear = int(sys.argv[2]) if len(sys.argv) > 2 else 1850 >endYear = int(sys.argv[3]) if len(sys.argv) > 3 else 2050 > >def timezones(): > try: > import pytz > return pytz.common_timezones > except ImportError: > print("'import pytz' failed") > return [ > "Africa/Johannesburg", > "Europe/Berlin", > "Pacific/Fiji", > ] > >startDate = datetime.date(startYear, 1, 1) >endDate = datetime.date(endYear, 1, 1) >pipeName = "pythonpipe" >acceptArg = "-accept=pipe,name=%s;urp;StarOffice.ServiceManager" % pipeName >url = "uno:pipe,name=%s;urp;StarOffice.ComponentContext" % pipeName > >for tz in timezones(): > process = None > desktop = None > document = None > try: > processEnv = os.environ.copy() > processEnv["TZ"] = tz > #processEnv["SAL_LOG"] = "+INFO.i18npool" > process = Popen([officePath, acceptArg], env=processEnv) > ctx = None > for i in range(10): > print("Connectiong...") > try: > localctx = uno.getComponentContext() > resolver = localctx.getServiceManager().createInstanceWithContext( > "com.sun.star.bridge.UnoUrlResolver", localctx) > ctx = resolver.resolve(url) > except NoConnectException: > sleep(i * 2 + 1) > if ctx: > break > if process.poll(): > raise Exception("Process exited") > if not ctx: > raise Exception("Connection failure") > > print("Checking: " + tz) > desktop = ctx.getServiceManager().createInstanceWithContext("com.sun.star.frame.Desktop", ctx) > #loadArg = PropertyValue() > #loadArg.Name = "Hidden" > #loadArg.Value = True > #document = desktop.loadComponentFromURL("private:factory/scalc", "_blank", 0, (loadArg,)); > document = desktop.loadComponentFromURL("private:factory/scalc", "_blank", 0, ()); > frame = document.CurrentController.Frame > dispatchHelper = ctx.getServiceManager().createInstance('com.sun.star.frame.DispatchHelper') > cell = document.CurrentController.ActiveSheet.getCellByPosition(0, 0) > > goToCellArg = PropertyValue() > goToCellArg.Name = "ToPoint" > goToCellArg.Value = "$A$1" > dispatchHelper.executeDispatch(frame, ".uno:GoToCell", "", 0, (goToCellArg,)) > > numErrors = 0 > for i in range((endDate - startDate).days + 1): > date = startDate + datetime.timedelta(days = i) > dateString = "%04d-%02d-%02d" % (date.year, date.month, date.day) # old strftime requires year >= 1900 > format = "YYYY-MM-DD" > charLocale = document.getPropertyValue("CharLocale") > numberFormats = document.getNumberFormats() > id = numberFormats.queryKey(format, charLocale, True) > if id == -1: > id = numberFormats.addNew(format, charLocale) > numberFormatValueArg = PropertyValue() > numberFormatValueArg.Name = "NumberFormatValue" > numberFormatValueArg.Value = id > dispatchHelper.executeDispatch(frame, ".uno:NumberFormatValue", "", 0, (numberFormatValueArg,)) > enterStringArg = PropertyValue() > enterStringArg.Name = "StringName" > enterStringArg.Value = dateString > dispatchHelper.executeDispatch(frame, ".uno:EnterString", "", 0, (enterStringArg,)) > result = "" + cell.String > if dateString != result: > numErrors += 1 > if numErrors > 100: > break > print('"' + tz + '","' + dateString + '","' + result + '"') > finally: > if document: > try: > document.dispose() > except Exception: # __main__.DisposeException > None > if desktop: > try: > desktop.terminate() > except Exception: # __main__.DisposeException > None > if process: > try: > if not process.poll(): > try: > process.send_signal(signal.SIGINT) > sleep(3) > except ValueError: # Windows > None > while not process.poll(): > print("terminating...") > process.terminate() > sleep(3) > if not process.poll(): > process.kill() > sleep(3) > except OSError: # ProcessLookupError > None
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 63230
:
79051
|
79052
|
99582
|
100184