diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-03-11 14:24:23 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-03-11 14:24:23 +0100 |
commit | 67d2af6fac2d9bad52a6b1f6e0cbd1229eb88a42 (patch) | |
tree | 898019746162b464578da9c8345158a74321c904 /toolkit/qa | |
parent | 86fb5fff88be611785b7908aac2a44475d77705f (diff) | |
parent | e2a3d487efb2bd5e582eb10e4150530c3f7377c5 (diff) |
Merge commit 'ooo/DEV300_m101' into intm101
The following builds for me:
basebmp, basegfx, comphelper, dtrans, i18npool, i18nutil, l10ntools, o3tl,
psprint_config, regexp, rsc, sax, sot, tools, ucbhelper, unotools, vcl
The rest still needs fixing ;-)
Conflicts:
canvas/prj/build.lst
canvas/source/cairo/cairo_textlayout.cxx
canvas/source/directx/dx_winstuff.hxx
canvas/source/tools/image.cxx
canvas/source/vcl/canvashelper.cxx
comphelper/inc/comphelper/documentconstants.hxx
comphelper/inc/comphelper/optionalvalue.hxx
comphelper/inc/comphelper/querydeep.hxx
comphelper/prj/build.lst
comphelper/qa/complex/makefile.mk
comphelper/qa/string/test_string_noadditional.cxx
comphelper/source/misc/componentmodule.cxx
comphelper/source/misc/mimeconfighelper.cxx
comphelper/source/misc/querydeep.cxx
comphelper/source/misc/uieventslogger.cxx
comphelper/source/property/TypeGeneration.cxx
comphelper/test/uno_iterators/uno_iterators.cxx
comphelper/util/makefile.mk
cppcanvas/source/mtfrenderer/implrenderer.cxx
dtrans/prj/build.lst
dtrans/source/generic/dtrans.cxx
dtrans/source/win32/dtobj/FmtFilter.cxx
i18npool/prj/build.lst
i18npool/source/localedata/data/localedata_others.map
i18npool/source/localedata/data/makefile.mk
i18npool/source/localedata/localedata.cxx
i18npool/source/localedata/saxparser.cxx
i18npool/source/registerservices/registerservices.cxx
i18npool/source/search/textsearch.cxx
l10ntools/inc/cfgmerge.hxx
l10ntools/inc/export.hxx
l10ntools/inc/gsicheck.hxx
l10ntools/inc/l10ntools/vosapp.hxx
l10ntools/inc/tagtest.hxx
l10ntools/inc/xmlparse.hxx
l10ntools/layout/layoutparse.cxx
l10ntools/layout/tralay.cxx
l10ntools/source/cfgmerge.cxx
l10ntools/source/export.cxx
l10ntools/source/export2.cxx
l10ntools/source/gsicheck.cxx
l10ntools/source/help/HelpLinker.cxx
l10ntools/source/lngex.cxx
l10ntools/source/lngmerge.cxx
l10ntools/source/merge.cxx
l10ntools/source/tagtest.cxx
l10ntools/source/xmlparse.cxx
padmin/source/fontentry.cxx
padmin/source/padialog.cxx
padmin/source/padialog.src
padmin/source/pamain.cxx
rsc/inc/rscarray.hxx
rsc/inc/rscclass.hxx
rsc/inc/rscclobj.hxx
rsc/inc/rsccont.hxx
rsc/inc/rscdb.hxx
rsc/inc/rscdef.hxx
rsc/inc/rscmgr.hxx
rsc/inc/rscrange.hxx
rsc/inc/rsctop.hxx
rsc/inc/vclrsc.hxx
rsc/source/parser/rscdb.cxx
rsc/source/parser/rscicpx.cxx
rsc/source/parser/rscinit.cxx
rsc/source/prj/start.cxx
rsc/source/res/rscarray.cxx
rsc/source/res/rscclass.cxx
rsc/source/res/rscclobj.cxx
rsc/source/res/rsccont.cxx
rsc/source/res/rscmgr.cxx
rsc/source/res/rscrange.cxx
rsc/source/res/rsctop.cxx
rsc/source/rsc/rsc.cxx
rsc/source/tools/rscdef.cxx
rsc/source/tools/rsctools.cxx
sax/source/expatwrap/sax_expat.cxx
sax/source/fastparser/facreg.cxx
sax/source/tools/fastserializer.cxx
sot/inc/sot/filelist.hxx
sot/inc/sot/object.hxx
sot/source/base/factory.cxx
sot/source/base/filelist.cxx
sot/source/sdstor/stg.cxx
sot/source/sdstor/stgcache.cxx
sot/source/sdstor/stgole.cxx
sot/source/sdstor/stgstrms.cxx
sot/source/sdstor/storage.cxx
sot/source/sdstor/ucbstorage.cxx
svl/inc/svl/cenumitm.hxx
svl/inc/svl/cintitem.hxx
svl/inc/svl/cntwall.hxx
svl/inc/svl/ctypeitm.hxx
svl/inc/svl/custritm.hxx
svl/inc/svl/dateitem.hxx
svl/inc/svl/filerec.hxx
svl/inc/svl/globalnameitem.hxx
svl/inc/svl/ilstitem.hxx
svl/inc/svl/imageitm.hxx
svl/inc/svl/intitem.hxx
svl/inc/svl/itempool.hxx
svl/inc/svl/itemset.hxx
svl/inc/svl/lckbitem.hxx
svl/inc/svl/poolitem.hxx
svl/inc/svl/ptitem.hxx
svl/inc/svl/rectitem.hxx
svl/inc/svl/sfontitm.hxx
svl/inc/svl/slstitm.hxx
svl/inc/svl/srchitem.hxx
svl/inc/svl/svarray.hxx
svl/inc/svl/svdde.hxx
svl/inc/svl/svstdarr.hxx
svl/inc/svl/szitem.hxx
svl/inc/svl/visitem.hxx
svl/inc/svl/zforlist.hxx
svl/inc/svl/zformat.hxx
svl/prj/build.lst
svl/qa/complex/ConfigItems/helper/ConfigItemTest.cxx
svl/qa/complex/ConfigItems/helper/makefile.mk
svl/qa/makefile.mk
svl/source/filepicker/pickerhelper.cxx
svl/source/filerec/filerec.cxx
svl/source/items/cenumitm.cxx
svl/source/items/cintitem.cxx
svl/source/items/cntwall.cxx
svl/source/items/ctypeitm.cxx
svl/source/items/custritm.cxx
svl/source/items/dateitem.cxx
svl/source/items/globalnameitem.cxx
svl/source/items/ilstitem.cxx
svl/source/items/imageitm.cxx
svl/source/items/intitem.cxx
svl/source/items/itempool.cxx
svl/source/items/itemprop.cxx
svl/source/items/itemset.cxx
svl/source/items/lckbitem.cxx
svl/source/items/poolio.cxx
svl/source/items/poolitem.cxx
svl/source/items/ptitem.cxx
svl/source/items/rectitem.cxx
svl/source/items/slstitm.cxx
svl/source/items/srchitem.cxx
svl/source/items/style.cxx
svl/source/items/szitem.cxx
svl/source/items/visitem.cxx
svl/source/items/whiter.cxx
svl/source/memtools/svarray.cxx
svl/source/misc/PasswordHelper.cxx
svl/source/misc/adrparse.cxx
svl/source/misc/lngmisc.cxx
svl/source/notify/brdcst.cxx
svl/source/notify/listener.cxx
svl/source/notify/listenerbase.cxx
svl/source/numbers/makefile.mk
svl/source/numbers/nbdll.cxx
svl/source/numbers/zforfind.cxx
svl/source/numbers/zforlist.cxx
svl/source/numbers/zformat.cxx
svl/source/numbers/zforscan.cxx
svl/source/passwordcontainer/passwordcontainer.cxx
svl/source/svdde/ddecli.cxx
svl/source/svdde/ddeimp.hxx
svl/source/svdde/ddemlos2.h
svl/source/svdde/ddesvr.cxx
svl/source/undo/undo.cxx
svl/source/uno/registerservices.cxx
svl/util/makefile.mk
svtools/bmpmaker/bmpsum.cxx
svtools/bmpmaker/g2g.cxx
svtools/bmpmaker/makefile.mk
svtools/inc/borderhelper.hxx
svtools/inc/svtools/accessiblefactory.hxx
svtools/inc/svtools/apearcfg.hxx
svtools/inc/svtools/brwbox.hxx
svtools/inc/svtools/ctrlbox.hxx
svtools/inc/svtools/ctrltool.hxx
svtools/inc/svtools/editbrowsebox.hxx
svtools/inc/svtools/ehdl.hxx
svtools/inc/svtools/embedhlp.hxx
svtools/inc/svtools/filter.hxx
svtools/inc/svtools/ivctrl.hxx
svtools/inc/svtools/parhtml.hxx
svtools/inc/svtools/printdlg.hxx
svtools/inc/svtools/rtftoken.h
svtools/inc/svtools/ruler.hxx
svtools/inc/svtools/svicnvw.hxx
svtools/inc/svtools/svlbitm.hxx
svtools/inc/svtools/svlbox.hxx
svtools/inc/svtools/svtreebx.hxx
svtools/inc/svtools/tabbar.hxx
svtools/inc/svtools/table/abstracttablecontrol.hxx
svtools/inc/svtools/taskbar.hxx
svtools/inc/svtools/textview.hxx
svtools/inc/svtools/valueset.hxx
svtools/source/brwbox/brwbox1.cxx
svtools/source/brwbox/brwbox2.cxx
svtools/source/brwbox/datwin.cxx
svtools/source/brwbox/datwin.hxx
svtools/source/brwbox/makefile.mk
svtools/source/config/apearcfg.cxx
svtools/source/config/htmlcfg.cxx
svtools/source/config/menuoptions.cxx
svtools/source/config/miscopt.cxx
svtools/source/contnr/cont_pch.cxx
svtools/source/contnr/ctrdll.cxx
svtools/source/contnr/fileview.cxx
svtools/source/contnr/imivctl1.cxx
svtools/source/contnr/ivctrl.cxx
svtools/source/contnr/makefile.mk
svtools/source/contnr/svcontnr.src
svtools/source/contnr/svicnvw.cxx
svtools/source/contnr/svimpbox.cxx
svtools/source/contnr/svimpicn.cxx
svtools/source/contnr/svlbitm.cxx
svtools/source/contnr/svtreebx.cxx
svtools/source/contnr/templwin.cxx
svtools/source/contnr/templwin.hxx
svtools/source/control/asynclink.cxx
svtools/source/control/ctrlbox.cxx
svtools/source/control/ctrldll.cxx
svtools/source/control/ctrltool.cxx
svtools/source/control/filectrl.cxx
svtools/source/control/filectrl.src
svtools/source/control/headbar.cxx
svtools/source/control/inettbc.cxx
svtools/source/control/makefile.mk
svtools/source/control/prgsbar.cxx
svtools/source/control/roadmap.cxx
svtools/source/control/ruler.cxx
svtools/source/control/scriptedtext.cxx
svtools/source/control/stdmenu.cxx
svtools/source/control/tabbar.cxx
svtools/source/control/taskbar.cxx
svtools/source/control/taskbox.cxx
svtools/source/control/taskmisc.cxx
svtools/source/control/taskstat.cxx
svtools/source/control/valueacc.cxx
svtools/source/control/valueset.cxx
svtools/source/dialogs/addresstemplate.cxx
svtools/source/dialogs/addresstemplate.src
svtools/source/dialogs/colrdlg.src
svtools/source/dialogs/filedlg2.cxx
svtools/source/dialogs/filedlg2.hxx
svtools/source/dialogs/makefile.mk
svtools/source/dialogs/printdlg.cxx
svtools/source/dialogs/printdlg.src
svtools/source/dialogs/propctrl.cxx
svtools/source/dialogs/propctrl.hxx
svtools/source/dialogs/property.cxx
svtools/source/edit/makefile.mk
svtools/source/edit/sychconv.cxx
svtools/source/edit/syntaxhighlight.cxx
svtools/source/edit/textdoc.cxx
svtools/source/edit/texteng.cxx
svtools/source/edit/textundo.cxx
svtools/source/edit/textview.cxx
svtools/source/filter.vcl/filter/SvFilterOptionsDialog.cxx
svtools/source/filter.vcl/filter/dlgejpg.cxx
svtools/source/filter.vcl/filter/dlgejpg.hxx
svtools/source/filter.vcl/filter/dlgejpg.src
svtools/source/filter.vcl/filter/dlgepng.cxx
svtools/source/filter.vcl/filter/dlgepng.hxx
svtools/source/filter.vcl/filter/dlgepng.src
svtools/source/filter.vcl/filter/dlgexpor.cxx
svtools/source/filter.vcl/filter/dlgexpor.hxx
svtools/source/filter.vcl/filter/dlgexpor.src
svtools/source/filter.vcl/filter/filter2.cxx
svtools/source/filter.vcl/filter/makefile.mk
svtools/source/filter.vcl/filter/sgfbram.cxx
svtools/source/filter.vcl/filter/sgvmain.cxx
svtools/source/filter.vcl/filter/sgvspln.cxx
svtools/source/filter.vcl/filter/strings.src
svtools/source/filter.vcl/jpeg/makefile.mk
svtools/source/filter.vcl/wmf/emfwr.cxx
svtools/source/filter.vcl/wmf/emfwr.hxx
svtools/source/filter.vcl/wmf/enhwmf.cxx
svtools/source/filter.vcl/wmf/winmtf.hxx
svtools/source/filter.vcl/wmf/wmfwr.cxx
svtools/source/filter.vcl/wmf/wmfwr.hxx
svtools/source/graphic/grfcache.cxx
svtools/source/graphic/grfcache.hxx
svtools/source/graphic/grfmgr.cxx
svtools/source/graphic/makefile.mk
svtools/source/inc/accessibletableimp.hxx
svtools/source/inc/svimpbox.hxx
svtools/source/java/patchjavaerror.src
svtools/source/misc/ehdl.cxx
svtools/source/misc/errtxt.src
svtools/source/misc/helpagentwindow.cxx
svtools/source/misc/imagemgr.cxx
svtools/source/misc/imagemgr.src
svtools/source/misc/imageresourceaccess.cxx
svtools/source/misc/imap.cxx
svtools/source/misc/langtab.src
svtools/source/misc/makefile.mk
svtools/source/misc/svtdata.cxx
svtools/source/misc/templatefoldercache.cxx
svtools/source/misc/transfer2.cxx
svtools/source/misc/undo.src
svtools/source/plugapp/commtest.cxx
svtools/source/plugapp/commtest.src
svtools/source/plugapp/makefile.mk
svtools/source/plugapp/testtool.src
svtools/source/productregistration/productregistration.cxx
svtools/source/svhtml/htmlkywd.cxx
svtools/source/svhtml/parhtml.cxx
svtools/source/svrtf/rtfkey2.cxx
svtools/source/svrtf/rtfkeywd.cxx
svtools/source/table/defaultinputhandler.cxx
svtools/source/table/makefile.mk
svtools/source/table/tablecontrol.cxx
svtools/source/table/tablecontrol_impl.cxx
svtools/source/table/tablecontrol_impl.hxx
svtools/source/table/tabledatawindow.cxx
svtools/source/table/tablegeometry.cxx
svtools/source/table/tablegeometry.hxx
svtools/source/toolpanel/makefile.mk
svtools/source/toolpanel/toolpaneldrawer.cxx
svtools/source/uno/addrtempuno.cxx
svtools/source/uno/miscservices.cxx
svtools/source/uno/svtxgridcontrol.cxx
svtools/source/uno/svtxgridcontrol.hxx
svtools/source/uno/toolboxcontroller.cxx
svtools/source/uno/treecontrolpeer.cxx
svtools/source/uno/unocontroltablemodel.cxx
svtools/source/uno/unocontroltablemodel.hxx
svtools/source/uno/unoimap.cxx
svtools/source/urlobj/inetimg.cxx
svtools/util/makefile.mk
svtools/workben/browser.cxx
svtools/workben/cui/makefile.mk
svtools/workben/makefile.mk
svtools/workben/stest.cxx
svtools/workben/toolpanel/makefile.mk
svtools/workben/urange.cxx
toolkit/inc/toolkit/awt/vclxdevice.hxx
toolkit/inc/toolkit/awt/vclxgraphics.hxx
toolkit/inc/toolkit/awt/vclxwindows.hxx
toolkit/inc/toolkit/controls/dialogcontrol.hxx
toolkit/inc/toolkit/helper/property.hxx
toolkit/inc/toolkit/helper/servicenames.hxx
toolkit/inc/toolkit/helper/throbberimpl.hxx
toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java
toolkit/source/awt/asynccallback.cxx
toolkit/source/awt/vclxgraphics.cxx
toolkit/source/awt/vclxtoolkit.cxx
toolkit/source/awt/vclxwindow.cxx
toolkit/source/awt/xsimpleanimation.cxx
toolkit/source/awt/xthrobber.cxx
toolkit/source/controls/dialogcontrol.cxx
toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
toolkit/source/controls/grid/defaultgriddatamodel.cxx
toolkit/source/controls/grid/gridcontrol.cxx
toolkit/source/controls/grid/initguard.hxx
toolkit/source/controls/unocontrol.cxx
toolkit/source/controls/unocontrolcontainer.cxx
toolkit/source/controls/unocontrols.cxx
toolkit/source/helper/listenermultiplexer.cxx
toolkit/source/helper/property.cxx
toolkit/source/helper/registerservices.cxx
toolkit/source/helper/servicenames.cxx
toolkit/source/helper/throbberimpl.cxx
toolkit/source/helper/tkresmgr.cxx
tools/StaticLibrary_ooopathutils.mk
tools/bootstrp/addexes/makefile.mk
tools/bootstrp/addexes2/makefile.mk
tools/bootstrp/addexes2/mkfilt.cxx
tools/bootstrp/command.cxx
tools/bootstrp/cppdep.cxx
tools/bootstrp/iserver.cxx
tools/bootstrp/makefile.mk
tools/bootstrp/mkcreate.cxx
tools/bootstrp/prj.cxx
tools/bootstrp/rscdep.cxx
tools/bootstrp/sstring.cxx
tools/inc/bootstrp/command.hxx
tools/inc/bootstrp/mkcreate.hxx
tools/inc/bootstrp/prj.hxx
tools/inc/bootstrp/sstring.hxx
tools/inc/tools/agapi.hxx
tools/inc/tools/agitem.hxx
tools/inc/tools/chapi.hxx
tools/inc/tools/download.hxx
tools/inc/tools/eacopier.hxx
tools/inc/tools/fract.hxx
tools/inc/tools/fsys.hxx
tools/inc/tools/geninfo.hxx
tools/inc/tools/globname.hxx
tools/inc/tools/inetmime.hxx
tools/inc/tools/multisel.hxx
tools/inc/tools/poly.hxx
tools/inc/tools/postsys.h
tools/inc/tools/postwin.h
tools/inc/tools/presys.h
tools/inc/tools/prewin.h
tools/inc/tools/pstm.hxx
tools/inc/tools/ref.hxx
tools/inc/tools/simplerm.hxx
tools/inc/tools/solar.h
tools/inc/tools/table.hxx
tools/inc/tools/urlkeys.hxx
tools/inc/tools/urlobj.hxx
tools/prj/build.lst
tools/prj/d.lst
tools/qa/makefile.mk
tools/source/communi/geninfo.cxx
tools/source/debug/debug.cxx
tools/source/fsys/dirent.cxx
tools/source/fsys/tdir.cxx
tools/source/fsys/unx.cxx
tools/source/fsys/urlobj.cxx
tools/source/generic/color.cxx
tools/source/generic/config.cxx
tools/source/generic/fract.cxx
tools/source/inet/inetmime.cxx
tools/source/memtools/multisel.cxx
tools/source/memtools/table.cxx
tools/source/rc/resmgr.cxx
tools/source/ref/globname.cxx
tools/source/ref/pstm.cxx
tools/source/solar/solar.c
tools/source/stream/strmos2.cxx
tools/source/stream/strmunx.cxx
tools/source/stream/strmwnt.cxx
tools/source/string/makefile.mk
tools/source/testtoolloader/testtoolloader.cxx
tools/test/makefile.mk
tools/util/makefile.mk
tools/win/inc/dll.hxx
tools/win/inc/parser.hxx
tools/win/inc/shellex.h
tools/win/inc/shutil.h
tools/win/inc/toolsdll.hxx
tools/win/inc/winshell.hxx
tools/workben/makefile.mk
ucbhelper/source/client/proxydecider.cxx
ucbhelper/workben/ucbexplorer/ucbexplorer.hrc
unotools/inc/unotools/unotunnelhelper.hxx
unotools/source/config/fltrcfg.cxx
unotools/source/config/lingucfg.cxx
unotools/source/config/misccfg.cxx
unotools/source/config/pathoptions.cxx
unotools/source/config/searchopt.cxx
unotools/source/i18n/localedatawrapper.cxx
unotools/source/ucbhelper/localfilehelper.cxx
unotools/source/ucbhelper/ucbhelper.cxx
unotools/source/ucbhelper/xtempfile.cxx
vcl/aqua/inc/salbmp.h
vcl/aqua/inc/salgdi.h
vcl/aqua/inc/salinst.h
vcl/aqua/source/app/salinst.cxx
vcl/aqua/source/gdi/aquaprintaccessoryview.mm
vcl/aqua/source/gdi/salgdi.cxx
vcl/aqua/source/gdi/salprn.cxx
vcl/aqua/source/window/salframeview.mm
vcl/aqua/source/window/salobj.cxx
vcl/inc/vcl/bitmap.hxx
vcl/inc/vcl/brdwin.hxx
vcl/inc/vcl/button.hxx
vcl/inc/vcl/cmdevt.hxx
vcl/inc/vcl/cvtgrf.hxx
vcl/inc/vcl/dialog.hxx
vcl/inc/vcl/dockwin.hxx
vcl/inc/vcl/event.hxx
vcl/inc/vcl/fixed.hxx
vcl/inc/vcl/fldunit.hxx
vcl/inc/vcl/floatwin.hxx
vcl/inc/vcl/gdimtf.hxx
vcl/inc/vcl/glyphcache.hxx
vcl/inc/vcl/graphite_adaptors.hxx
vcl/inc/vcl/graphite_features.hxx
vcl/inc/vcl/graphite_layout.hxx
vcl/inc/vcl/ilstbox.hxx
vcl/inc/vcl/image.h
vcl/inc/vcl/imgctrl.hxx
vcl/inc/vcl/impbmpconv.hxx
vcl/inc/vcl/impprn.hxx
vcl/inc/vcl/jobset.h
vcl/inc/vcl/keycodes.hxx
vcl/inc/vcl/lstbox.hxx
vcl/inc/vcl/mapunit.hxx
vcl/inc/vcl/menu.hxx
vcl/inc/vcl/msgbox.hxx
vcl/inc/vcl/outdev.hxx
vcl/inc/vcl/prndlg.hxx
vcl/inc/vcl/salatype.hxx
vcl/inc/vcl/salbmp.hxx
vcl/inc/vcl/salgdi.hxx
vcl/inc/vcl/salinst.hxx
vcl/inc/vcl/seleng.hxx
vcl/inc/vcl/settings.hxx
vcl/inc/vcl/smartid.hxx
vcl/inc/vcl/status.hxx
vcl/inc/vcl/strhelper.hxx
vcl/inc/vcl/svapp.hxx
vcl/inc/vcl/svdata.hxx
vcl/inc/vcl/syschild.hxx
vcl/inc/vcl/sysdata.hxx
vcl/inc/vcl/taskpanelist.hxx
vcl/inc/vcl/toolbox.hxx
vcl/inc/vcl/vclevent.hxx
vcl/inc/vcl/windata.hxx
vcl/inc/vcl/window.hxx
vcl/inc/vcl/wintypes.hxx
vcl/os2/source/app/salinst.cxx
vcl/os2/source/gdi/salgdi.cxx
vcl/os2/source/window/salmenu.cxx
vcl/os2/source/window/salobj.cxx
vcl/prj/build.lst
vcl/source/app/dbggui.cxx
vcl/source/app/help.cxx
vcl/source/app/idlemgr.cxx
vcl/source/app/settings.cxx
vcl/source/app/svapp.cxx
vcl/source/app/svdata.cxx
vcl/source/app/svmain.cxx
vcl/source/app/svmainhook.cxx
vcl/source/app/unohelp.cxx
vcl/source/app/vclevent.cxx
vcl/source/control/button.cxx
vcl/source/control/combobox.cxx
vcl/source/control/edit.cxx
vcl/source/control/field.cxx
vcl/source/control/fixed.cxx
vcl/source/control/ilstbox.cxx
vcl/source/control/imgctrl.cxx
vcl/source/control/makefile.mk
vcl/source/control/tabctrl.cxx
vcl/source/gdi/bitmap.cxx
vcl/source/gdi/bitmap2.cxx
vcl/source/gdi/bitmap4.cxx
vcl/source/gdi/bmpconv.cxx
vcl/source/gdi/cvtsvm.cxx
vcl/source/gdi/font.cxx
vcl/source/gdi/gdimtf.cxx
vcl/source/gdi/image.cxx
vcl/source/gdi/impimage.cxx
vcl/source/gdi/jobset.cxx
vcl/source/gdi/makefile.mk
vcl/source/gdi/metaact.cxx
vcl/source/gdi/outdev.cxx
vcl/source/gdi/outdev3.cxx
vcl/source/gdi/outdev4.cxx
vcl/source/gdi/outdevnative.cxx
vcl/source/gdi/pdfwriter.cxx
vcl/source/gdi/pdfwriter_impl.cxx
vcl/source/gdi/print3.cxx
vcl/source/gdi/salmisc.cxx
vcl/source/glyphs/gcach_ftyp.cxx
vcl/source/glyphs/gcach_ftyp.hxx
vcl/source/glyphs/glyphcache.cxx
vcl/source/glyphs/graphite_cache.cxx
vcl/source/glyphs/graphite_layout.cxx
vcl/source/glyphs/graphite_textsrc.hxx
vcl/source/helper/canvasbitmap.cxx
vcl/source/helper/smartid.cxx
vcl/source/helper/xconnection.cxx
vcl/source/src/btntext.src
vcl/source/src/images.src
vcl/source/src/print.src
vcl/source/window/accel.cxx
vcl/source/window/accmgr.cxx
vcl/source/window/brdwin.cxx
vcl/source/window/btndlg.cxx
vcl/source/window/dlgctrl.cxx
vcl/source/window/javachild.cxx
vcl/source/window/menu.cxx
vcl/source/window/msgbox.cxx
vcl/source/window/printdlg.cxx
vcl/source/window/status.cxx
vcl/source/window/syschild.cxx
vcl/source/window/toolbox.cxx
vcl/source/window/toolbox2.cxx
vcl/source/window/window.cxx
vcl/source/window/window2.cxx
vcl/source/window/wrkwin.cxx
vcl/unx/gtk/app/gtkdata.cxx
vcl/unx/gtk/app/gtkinst.cxx
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
vcl/unx/gtk/window/gtkframe.cxx
vcl/unx/gtk/window/gtkobject.cxx
vcl/unx/headless/svpbmp.hxx
vcl/unx/headless/svpgdi.cxx
vcl/unx/headless/svpgdi.hxx
vcl/unx/headless/svpinst.cxx
vcl/unx/headless/svpinst.hxx
vcl/unx/headless/svpprn.cxx
vcl/unx/headless/svpprn.hxx
vcl/unx/headless/svppspgraphics.cxx
vcl/unx/headless/svppspgraphics.hxx
vcl/unx/headless/svptext.cxx
vcl/unx/inc/dtint.hxx
vcl/unx/inc/plugins/gtk/gtkdata.hxx
vcl/unx/inc/pspgraphics.h
vcl/unx/inc/salbmp.h
vcl/unx/inc/saldata.hxx
vcl/unx/inc/saldisp.hxx
vcl/unx/inc/salgdi.h
vcl/unx/inc/salinst.h
vcl/unx/inc/xfont.hxx
vcl/unx/kde/kdedata.cxx
vcl/unx/kde4/KDESalGraphics.cxx
vcl/unx/source/app/keysymnames.cxx
vcl/unx/source/app/saldata.cxx
vcl/unx/source/app/saldisp.cxx
vcl/unx/source/app/salinst.cxx
vcl/unx/source/app/wmadaptor.cxx
vcl/unx/source/dtrans/X11_selection.cxx
vcl/unx/source/dtrans/X11_service.cxx
vcl/unx/source/gdi/makefile.mk
vcl/unx/source/gdi/pspgraphics.cxx
vcl/unx/source/gdi/salgdi.cxx
vcl/unx/source/gdi/salgdi3.cxx
vcl/unx/source/gdi/salprnpsp.cxx
vcl/unx/source/gdi/xfont.cxx
vcl/unx/source/gdi/xlfd_attr.cxx
vcl/unx/source/gdi/xlfd_attr.hxx
vcl/unx/source/gdi/xlfd_extd.cxx
vcl/unx/source/gdi/xlfd_extd.hxx
vcl/unx/source/gdi/xlfd_smpl.cxx
vcl/unx/source/gdi/xlfd_smpl.hxx
vcl/unx/source/printer/ppdparser.cxx
vcl/unx/source/printer/printerinfomanager.cxx
vcl/unx/source/window/salframe.cxx
vcl/unx/source/window/salmenu.cxx
vcl/unx/source/window/salobj.cxx
vcl/util/makefile2.pmk
vcl/win/inc/salbmp.h
vcl/win/inc/saldata.hxx
vcl/win/inc/salgdi.h
vcl/win/inc/salinst.h
vcl/win/source/app/saldata.cxx
vcl/win/source/app/salinst.cxx
vcl/win/source/gdi/salgdi.cxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/salprn.cxx
vcl/win/source/gdi/winlayout.cxx
vcl/win/source/window/salframe.cxx
vcl/win/source/window/salobj.cxx
vcl/workben/outdevgrind.cxx
vos/inc/vos/execabl.hxx
vos/inc/vos/macros.hxx
vos/inc/vos/pipe.hxx
vos/inc/vos/process.hxx
vos/inc/vos/refernce.hxx
vos/inc/vos/signal.hxx
vos/inc/vos/socket.hxx
vos/inc/vos/stream.hxx
vos/inc/vos/thread.hxx
vos/source/pipe.cxx
vos/source/process.cxx
vos/source/signal.cxx
vos/source/thread.cxx
vos/source/timer.cxx
Diffstat (limited to 'toolkit/qa')
26 files changed, 2883 insertions, 1750 deletions
diff --git a/toolkit/qa/complex/toolkit/AccessibleStatusBar.java b/toolkit/qa/complex/toolkit/AccessibleStatusBar.java new file mode 100755 index 000000000000..d4f2329d8f31 --- /dev/null +++ b/toolkit/qa/complex/toolkit/AccessibleStatusBar.java @@ -0,0 +1,338 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.toolkit; + +import complex.toolkit.accessibility._XAccessibleEventBroadcaster; +import complex.toolkit.accessibility._XAccessibleExtendedComponent; +import complex.toolkit.accessibility._XAccessibleComponent; +import complex.toolkit.accessibility._XAccessibleContext; +import java.util.logging.Logger; +import java.util.logging.Level; +import util.SOfficeFactory; +import util.AccessibilityTools; +import com.sun.star.awt.XWindow; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.sheet.XSpreadsheetDocument; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.XCloseable; +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.awt.XExtendedToolkit; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +/** + * + */ +public class AccessibleStatusBar { + + XInterface testObject = null; + XMultiServiceFactory xMSF = null; + XWindow xWindow = null; + + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + + /** + * Sleeps for 0.5 sec. to allow StarOffice to react on <code> + * reset</code> call. + */ + private void shortWait() { + try { + Thread.sleep(500) ; + } catch (InterruptedException e) { + System.out.println("While waiting :" + e) ; + } + } + + /** + * Check document types + */ + @Test + public void checkDocs() { + checkWriterDoc(); + checkMathDoc(); + checkDrawDoc(); + checkImpressDoc(); + checkCalcDoc(); + } + + /** + * Test the interfaces on a writer document + */ + public void checkWriterDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XTextDocument xTextDoc = null; + try { + System.out.println("****** Open a new writer document"); + xTextDoc = xSOF.createTextDoc("_blank"); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xTextDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xTextDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + + /** + * Test the interfaces on a math document + */ + public void checkMathDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XComponent xMathDoc = null; + try { + System.out.println("****** Open a new math document"); + xMathDoc = xSOF.createMathDoc("_blank"); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xMathDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xMathDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + + /** + * Test the interfaces on a draw document + */ + public void checkDrawDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XComponent xDrawDoc = null; + try { + System.out.println("****** Open a new draw document"); + xDrawDoc = xSOF.createDrawDoc("_blank"); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xDrawDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xDrawDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + + /** + * Test the interfaces on an impress document + */ + public void checkImpressDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XComponent xImpressDoc = null; + try { + System.out.println("****** Open a new impress document"); + xImpressDoc = xSOF.createImpressDoc("_blank"); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xImpressDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xImpressDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + /** + * Test the interfaces on an calc document + */ + public void checkCalcDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XSpreadsheetDocument xSpreadsheetDoc = null; + try { + System.out.println("****** Open a new calc document"); + xSpreadsheetDoc = xSOF.createCalcDoc("_blank"); + shortWait(); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xSpreadsheetDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + + public void getTestObject() { + try { + XInterface xIfc = (XInterface) xMSF.createInstance( + "com.sun.star.awt.Toolkit") ; + XExtendedToolkit tk = UnoRuntime.queryInterface(XExtendedToolkit.class, xIfc); + + shortWait(); + xWindow = UnoRuntime.queryInterface(XWindow.class, tk.getActiveTopWindow()); + + shortWait(); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + XAccessibleContext parentContext = null; + + System.out.println("Get the accessible status bar."); + parentContext = AccessibilityTools.getAccessibleObjectForRole( + xRoot, AccessibleRole.STATUS_BAR, ""); + shortWait(); + System.out.println("...OK."); + + XServiceInfo xSI = UnoRuntime.queryInterface(XServiceInfo.class, parentContext); + String[] services = xSI.getSupportedServiceNames(); + System.out.println("*****"); + System.out.println("* Implementation Name: " + xSI.getImplementationName()); + for (int i=0; i<services.length; i++) + { + System.out.println("* ServiceName " + i + ": " + services[i]); + } + System.out.println("*****"); + testObject=parentContext; + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + catch(Throwable t) { + System.out.println("Got throwable:"); + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", t ); + } + } + + public void runAllInterfaceTests() { + System.out.println("*** Now testing XAccessibleComponent ***"); + _XAccessibleComponent _xAccCompTest = + new _XAccessibleComponent(testObject); + assertTrue("failed: XAccessibleComponent::getBounds", _xAccCompTest._getBounds()); + assertTrue("failed: XAccessibleComponent::contains", _xAccCompTest._containsPoint()); + assertTrue("failed: XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint()); + assertTrue("failed: XAccessibleComponent::getBackground", _xAccCompTest._getBackground()); + assertTrue("failed: XAccessibleComponent::getForeground", _xAccCompTest._getForeground()); + assertTrue("failed: XAccessibleComponent::getLocation", _xAccCompTest._getLocation()); + assertTrue("failed: XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen()); + assertTrue("failed: XAccessibleComponent::getSize", _xAccCompTest._getSize()); + assertTrue("failed: XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus()); + + System.out.println("*** Now testing XAccessibleContext ***"); + _XAccessibleContext _xAccContext = + new _XAccessibleContext(testObject); + assertTrue("failed: XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount()); + assertTrue("failed: XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild()); + assertTrue("failed: XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription()); + assertTrue("failed: XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName()); + assertTrue("failed: XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent()); + assertTrue("failed: XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent()); + assertTrue("failed: XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet()); + assertTrue("failed: XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole()); + assertTrue("failed: XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet()); + assertTrue("failed: XAccessibleContext::getLocale", _xAccContext._getLocale()); + + System.out.println("*** Now testing XAccessibleExtendedComponent ***"); + _XAccessibleExtendedComponent _xAccExtComp = + new _XAccessibleExtendedComponent(testObject); + assertTrue("failed: XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont()); + assertTrue("failed: XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText()); + assertTrue("failed: XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText()); + + System.out.println("*** Now testing XAccessibleEventBroadcaster ***"); + _XAccessibleEventBroadcaster _xAccEvBcast = + new _XAccessibleEventBroadcaster(testObject, xWindow); + assertTrue("failed: XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener()); + assertTrue("failed: XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener()); + } + + + + + @BeforeClass + public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass + public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + +} diff --git a/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java b/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java new file mode 100755 index 000000000000..edd84651d45e --- /dev/null +++ b/toolkit/qa/complex/toolkit/AccessibleStatusBarItem.java @@ -0,0 +1,381 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.toolkit; + +import java.util.logging.Logger; +import java.util.logging.Level; +import complex.toolkit.accessibility._XAccessibleEventBroadcaster; +import complex.toolkit.accessibility._XAccessibleExtendedComponent; +import complex.toolkit.accessibility._XAccessibleText; +import complex.toolkit.accessibility._XAccessibleComponent; +import complex.toolkit.accessibility._XAccessibleContext; +import util.SOfficeFactory; +import util.AccessibilityTools; +import com.sun.star.awt.XWindow; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XServiceInfo; +import com.sun.star.sheet.XSpreadsheetDocument; +import com.sun.star.text.XTextDocument; +import com.sun.star.uno.XInterface; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.XCloseable; +import com.sun.star.accessibility.AccessibleRole; +import com.sun.star.accessibility.XAccessible; +import com.sun.star.accessibility.XAccessibleContext; +import com.sun.star.awt.XExtendedToolkit; + + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +/** + * + */ +public class AccessibleStatusBarItem { + + XMultiServiceFactory xMSF = null; + XAccessibleContext testObject = null; + XWindow xWindow = null; + + /** + * Sleeps for a certain time. + * @param Thread is sleeping for this time in milliseconds. + */ + private void shortWait() { + try { + Thread.sleep(500); + } catch (InterruptedException e) { + System.out.println("While waiting :" + e) ; + } + } + + /** + * Check document types + */ + @Test + public void checkDocs() + { + checkWriterDoc(); + checkMathDoc(); + checkDrawDoc(); + checkImpressDoc(); + checkCalcDoc(); + } + + private XMultiServiceFactory getMSF() + { + final XMultiServiceFactory xMSF1 = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + return xMSF1; + } + + /** + * Test the interfaces on a writer document + */ + private void checkWriterDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XTextDocument xTextDoc = null; + try { + System.out.println("****** Open a new writer document"); + xTextDoc = xSOF.createTextDoc("_blank"); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xTextDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xTextDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + + /** + * Test the interfaces on a math document + */ + public void checkMathDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XComponent xMathDoc = null; + try { + System.out.println("****** Open a new math document"); + xMathDoc = xSOF.createMathDoc("_blank"); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xMathDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xMathDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + + /** + * Test the interfaces on a draw document + */ + public void checkDrawDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XComponent xDrawDoc = null; + try { + System.out.println("****** Open a new draw document"); + xDrawDoc = xSOF.createDrawDoc("_blank"); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xDrawDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xDrawDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + + /** + * Test the interfaces on an impress document + */ + public void checkImpressDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XComponent xImpressDoc = null; + try { + System.out.println("****** Open a new impress document"); + xImpressDoc = xSOF.createImpressDoc("_blank"); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xImpressDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xImpressDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + /** + * Test the interfaces on an calc document + */ + public void checkCalcDoc() { + xMSF = getMSF(); + SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); + XSpreadsheetDocument xSpreadsheetDoc = null; + try { + System.out.println("****** Open a new calc document"); + xSpreadsheetDoc = xSOF.createCalcDoc("_blank"); + shortWait(); + getTestObject(); + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + runAllInterfaceTests(); + + if (xSpreadsheetDoc != null) { + XCloseable xClose = UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc); + try { + xClose.close(false); + } + catch(com.sun.star.util.CloseVetoException e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + } + } + + public void getTestObject() { + try { + XInterface xIfc = (XInterface) xMSF.createInstance( + "com.sun.star.awt.Toolkit") ; + XExtendedToolkit tk = + UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc); + + shortWait(); + xWindow = UnoRuntime.queryInterface( + XWindow.class,tk.getActiveTopWindow()); + + shortWait(); + XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow); + XAccessibleContext parentContext = null; + + System.out.println("Get the accessible status bar."); + parentContext = AccessibilityTools.getAccessibleObjectForRole( + xRoot, AccessibleRole.STATUS_BAR, ""); + shortWait(); + if ( parentContext == null ) { + fail("Could not create a test object."); + } + System.out.println("...OK."); + + testObject=parentContext; + } + catch(com.sun.star.uno.Exception e) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", e ); + } + catch(Throwable t) { + Logger.getLogger( this.getClass().getName() ).log( Level.SEVERE, "caught an exception", t ); + } + } + + public void runAllInterfaceTests() { + int count = testObject.getAccessibleChildCount(); + System.out.println("*****"); + System.out.println("**** Found items to test: " + count); + for (int i=0;i<count;i++){ + System.out.println("**** Now testing StatusBarItem " + i + "."); + XAccessible object = null; + try { + object = testObject.getAccessibleChild(i); + } + catch(com.sun.star.lang.IndexOutOfBoundsException e) { + System.out.println("* Cannot get item Nr: " + i); + continue; + } + XServiceInfo xSI = UnoRuntime.queryInterface( + XServiceInfo.class,object); + String[] services = xSI.getSupportedServiceNames(); + System.out.println("* Implementation Name: " + xSI.getImplementationName()); + String accName = object.getAccessibleContext().getAccessibleName(); + System.out.println("* Accessible Name: " + accName); + for (int j=0; i<services.length; i++) + { + System.out.println("* ServiceName "+i+": "+ services[j]); + } + System.out.println("*****"); + + System.out.println("*** Now testing XAccessibleComponent ***"); + _XAccessibleComponent _xAccCompTest = + new _XAccessibleComponent(object); + assertTrue("failed: "+accName+" - XAccessibleComponent::getBounds", _xAccCompTest._getBounds()); + assertTrue("failed: "+accName+" - XAccessibleComponent::contains", _xAccCompTest._containsPoint()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getBackground", _xAccCompTest._getBackground()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getForeground", _xAccCompTest._getForeground()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getLocation", _xAccCompTest._getLocation()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen()); + assertTrue("failed: "+accName+" - XAccessibleComponent::getSize", _xAccCompTest._getSize()); + assertTrue("failed: "+accName+" - XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus()); + + System.out.println("*** Now testing XAccessibleContext ***"); + _XAccessibleContext _xAccContext = + new _XAccessibleContext(object); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole()); + assertTrue("failed: "+accName+" - XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet()); + assertTrue("failed: "+accName+" - XAccessibleContext::getLocale", _xAccContext._getLocale()); + + System.out.println("*** Now testing XAccessibleExtendedComponent ***"); + _XAccessibleExtendedComponent _xAccExtComp = + new _XAccessibleExtendedComponent(object); + assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont()); + assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText()); + assertTrue("failed: "+accName+" - XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText()); + + System.out.println("*** Now testing XAccessibleEventBroadcaster ***"); + _XAccessibleEventBroadcaster _xAccEvBcast = + new _XAccessibleEventBroadcaster(object, xWindow); + assertTrue("failed: "+accName+" - XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener()); + assertTrue("failed: "+accName+" - XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener()); + + System.out.println("*** Now testing XAccessibleText ***"); + _XAccessibleText _xAccText = + new _XAccessibleText(object, xMSF, "true"); + assertTrue("failed: "+accName+" - XAccessibleText::getText", _xAccText._getText()); + assertTrue("failed: "+accName+" - XAccessibleText::getCharacterCount", _xAccText._getCharacterCount()); + assertTrue("failed: "+accName+" - XAccessibleText::getCharacterBounds", _xAccText._getCharacterBounds()); + assertTrue("failed: "+accName+" - XAccessibleText::setSelection", _xAccText._setSelection()); + assertTrue("failed: "+accName+" - XAccessibleText::copyText", _xAccText._copyText()); + assertTrue("failed: "+accName+" - XAccessibleText::getCharacter", _xAccText._getCharacter()); + assertTrue("failed: "+accName+" - XAccessibleText::getCharacterAttributes", _xAccText._getCharacterAttributes()); + assertTrue("failed: "+accName+" - XAccessibleText::getIndexAtPoint", _xAccText._getIndexAtPoint()); + assertTrue("failed: "+accName+" - XAccessibleText::getSelectedText", _xAccText._getSelectedText()); + assertTrue("failed: "+accName+" - XAccessibleText::getSelectionEnd", _xAccText._getSelectionEnd()); + assertTrue("failed: "+accName+" - XAccessibleText::getSelectionStart", _xAccText._getSelectionStart()); + assertTrue("failed: "+accName+" - XAccessibleText::getTextAtIndex", _xAccText._getTextAtIndex()); + assertTrue("failed: "+accName+" - XAccessibleText::getTextBeforeIndex", _xAccText._getTextBeforeIndex()); + assertTrue("failed: "+accName+" - XAccessibleText::getBehindIndex", _xAccText._getTextBehindIndex()); + assertTrue("failed: "+accName+" - XAccessibleText::getTextRange", _xAccText._getTextRange()); + assertTrue("failed: "+accName+" - XAccessibleText::setCaretPosition", _xAccText._setCaretPosition()); + assertTrue("failed: "+accName+" - XAccessibleText::getCaretPosition", _xAccText._getCaretPosition()); + } + } + + + + + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + + +} diff --git a/toolkit/qa/complex/toolkit/Assert.java b/toolkit/qa/complex/toolkit/Assert.java new file mode 100755 index 000000000000..93b1a2c490e1 --- /dev/null +++ b/toolkit/qa/complex/toolkit/Assert.java @@ -0,0 +1,234 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + *************************************************************************/ + +package complex.toolkit; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import com.sun.star.uno.UnoRuntime; +import static org.junit.Assert.*; + +/** + * provides assertion capabilities not found in {@link org.junit.Assert} + * @author frank.schoenheit@oracle.com + */ +public class Assert +{ + // -------------------------------------------------------------------------------------------------------- + /** invokes a given method on a given object, and assures a certain exception is caught + * @param i_message + * is the message to print when the check fails + * @param i_object + * is the object to invoke the method on + * @param i_methodName + * is the name of the method to invoke + * @param i_methodArgs + * are the arguments to pass to the method. + * @param i_argClasses + * are the classes to assume for the arguments of the methods + * @param i_expectedExceptionClass + * is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + public static void assertException( final String i_message, final Object i_object, final String i_methodName, + final Class[] i_argClasses, final Object[] i_methodArgs, final Class i_expectedExceptionClass ) + { + Class objectClass = i_object.getClass(); + + boolean noExceptionAllowed = ( i_expectedExceptionClass == null ); + + boolean caughtExpected = noExceptionAllowed ? true : false; + try + { + Method method = impl_getMethod( objectClass, i_methodName, i_argClasses ); + method.invoke(i_object, i_methodArgs ); + } + catch ( NoSuchMethodException e ) + { + StringBuilder message = new StringBuilder(); + message.append( "no such method: " ).append( objectClass.getName() ).append( "." ).append( i_methodName ).append( "( " ); + for ( int i=0; i<i_argClasses.length; ++i ) + { + message.append( i_argClasses[i].getName() ); + if ( i<i_argClasses.length - 1 ) + message.append( ", " ); + } + message.append( " )" ); + fail( message.toString() ); + } + catch ( InvocationTargetException e ) + { + caughtExpected = noExceptionAllowed + ? false + : ( e.getTargetException().getClass().equals( i_expectedExceptionClass ) ); + } + catch( Exception e ) + { + caughtExpected = false; + } + + assertTrue( i_message, caughtExpected ); + } + + /** + * retrieves a method, given by name and parameter signature, from the given class + * + * The method does somewhat more than simply calling {@link Class.getMethod}. In particular, it recognizes + * primitiive parameter types, and attempts to find a method taking the given primitive type, instead of the + * type represented by the parameter class. + * + * For instance, if you have a method <code>foo( int )</code>, {@link Class.getMethod} would not return this + * method when you pass <code>Integer.class</code>. <code>impl_getMethod</code> will recognize this, and + * properly retrieve the method. + * + * Note: <code>impl_getMethod</code> is limited in that it will not try all possible combinations of primitive + * and non-primitive types. That is, a method like <code>foo( int, Integer, int )</code> is likely to not be + * found. + * + * @param i_obbjectClass + * @param i_methodName + * @param i_argClasses + * @return + */ + private static Method impl_getMethod( final Class i_objectClass, final String i_methodName, final Class[] i_argClasses ) throws NoSuchMethodException + { + try + { + return i_objectClass.getMethod( i_methodName, i_argClasses ); + } + catch ( NoSuchMethodException ex ) + { + } + + int substitutedTypes = 0; + int substitutedTypesLastRound = 0; + final Class[][] substitutionTable = new Class[][] { + new Class[] { Long.class, long.class }, + new Class[] { Integer.class, int.class }, + new Class[] { Short.class, short.class }, + new Class[] { Byte.class, byte.class }, + new Class[] { Double.class, double.class }, + new Class[] { Float.class, float.class }, + new Class[] { Character.class, char.class } + }; + do + { + substitutedTypes = 0; + final Class[] argClasses = new Class[ i_argClasses.length ]; + for ( int i=0; i < argClasses.length; ++i ) + { + argClasses[i] = i_argClasses[i]; + if ( substitutedTypes > substitutedTypesLastRound ) + continue; + + for ( int c=0; c<substitutionTable.length; ++c ) + { + if ( i_argClasses[i].equals( substitutionTable[c][0] ) ) + { + argClasses[i] = substitutionTable[c][1]; + ++substitutedTypes; + break; + } + } + } + if ( substitutedTypes == substitutedTypesLastRound ) + throw new NoSuchMethodException(); + substitutedTypesLastRound = substitutedTypes; + + try + { + return i_objectClass.getMethod( i_methodName, argClasses ); + } + catch ( NoSuchMethodException e ) + { + } + } + while ( substitutedTypes > 0 ); + throw new NoSuchMethodException(); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param i_message is the message to print when the check fails + * @param i_object is the object to invoke the method on + * @param i_methodName is the name of the method to invoke + * @param i_methodArgs are the arguments to pass to the method. Those implicitly define + * the classes of the arguments of the method which is called. + * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + public static void assertException( final String i_message, final Object i_object, final String i_methodName, + final Object[] i_methodArgs, final Class i_expectedExceptionClass ) + { + Class[] argClasses = new Class[ i_methodArgs.length ]; + for ( int i=0; i<i_methodArgs.length; ++i ) + argClasses[i] = i_methodArgs[i].getClass(); + assertException( i_message, i_object, i_methodName, argClasses, i_methodArgs, i_expectedExceptionClass ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param i_object is the object to invoke the method on + * @param i_methodName is the name of the method to invoke + * @param i_methodArgs are the arguments to pass to the method. Those implicitly define + * the classes of the arguments of the method which is called. + * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + public static void assertException( final Object i_object, final String i_methodName, final Object[] i_methodArgs, + final Class i_expectedExceptionClass ) + { + assertException( + "did not catch the expected exception (" + + ( ( i_expectedExceptionClass == null ) ? "none" : i_expectedExceptionClass.getName() ) + + ") while calling " + i_object.getClass().getName() + "." + i_methodName, + i_object, i_methodName, i_methodArgs, i_expectedExceptionClass ); + } + + /** invokes a given method on a given object, and assures a certain exception is caught + * @param i_object is the object to invoke the method on + * @param i_methodName is the name of the method to invoke + * @param i_methodArgs are the arguments to pass to the method + * @param i_argClasses are the classes to assume for the arguments of the methods + * @param i_expectedExceptionClass is the class of the exception to be caught. If this is null, + * it means that <em>no</em> exception must be throw by invoking the method. + */ + public static void assertException( final Object i_object, final String i_methodName, final Class[] i_argClasses, + final Object[] i_methodArgs, final Class i_expectedExceptionClass ) + { + assertException( + "did not catch the expected exception (" + + ( ( i_expectedExceptionClass == null ) ? "none" : i_expectedExceptionClass.getName() ) + + ") while calling " + i_object.getClass().getName() + "." + i_methodName, + i_object, i_methodName, i_argClasses, i_methodArgs, i_expectedExceptionClass ); + } + + // -------------------------------------------------------------------------------------------------------- + public static void assertException( Object i_object, Class _unoInterfaceClass, String i_methodName, Object[] i_methodArgs, + Class i_expectedExceptionClass ) + { + assertException( UnoRuntime.queryInterface( _unoInterfaceClass, i_object ), i_methodName, + i_methodArgs, i_expectedExceptionClass ); + } +} diff --git a/toolkit/qa/complex/toolkit/CallbackClass.java b/toolkit/qa/complex/toolkit/CallbackClass.java deleted file mode 100644 index efc0ef91f7c0..000000000000 --- a/toolkit/qa/complex/toolkit/CallbackClass.java +++ /dev/null @@ -1,67 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.toolkit; - -import com.sun.star.awt.XCallback; -import lib.MultiMethodTest; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; -import share.LogWriter; - -/** - * Testing <code>com.sun.star.awt.XRequestCallback</code> - * interface methods : - * <ul> - * <li><code> addCallback()</code></li> - * </ul> <p> - * @see com.sun.star.awt.XRequestCallback - */ -public class CallbackClass implements XCallback{ - - private LogWriter log; - - private XMultiServiceFactory xMSF; - - - public CallbackClass(LogWriter log, XMultiServiceFactory xMSF ) { - - this.xMSF = xMSF; - this.log = log; - } - - - /** - * Callback method which will be called by the asynchronous - * service where we have added our request before. - */ - public void notify( Object aData ) { - - log.println("callback called successfully" ); - } -} diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java deleted file mode 100755 index fee95f2e6de0..000000000000 --- a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBar.java +++ /dev/null @@ -1,331 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.toolkit; - -import complexlib.ComplexTestCase; -import util.SOfficeFactory; -import util.AccessibilityTools; -import complex.toolkit.interface_tests._XAccessibleComponent; -import complex.toolkit.interface_tests._XAccessibleContext; -import complex.toolkit.interface_tests._XAccessibleExtendedComponent; -import complex.toolkit.interface_tests._XAccessibleEventBroadcaster; -import com.sun.star.awt.XWindow; -import com.sun.star.chart.XChartDocument; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.sheet.XSpreadsheetDocument; -import com.sun.star.text.XTextDocument; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.XCloseable; -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.awt.XExtendedToolkit; -import java.io.PrintWriter; - -/** - * - */ -public class CheckAccessibleStatusBar extends ComplexTestCase { - - XInterface testObject = null; - XMultiServiceFactory xMSF = null; - XWindow xWindow = null; - - public String[] getTestMethodNames() { - return new String[]{"checkDocs"};//WriterDoc", "checkDrawDoc", -// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"}; - } - -/* public String getTestObjectName() { - return "com.sun.star.awt.AccessibleStatusBar"; - } -*/ - /** - * Sleeps for 0.5 sec. to allow StarOffice to react on <code> - * reset</code> call. - */ - private void shortWait() { - try { - Thread.sleep(500) ; - } catch (InterruptedException e) { - log.println("While waiting :" + e) ; - } - } - - /** - * Check document types - */ - public void checkDocs() { - Object doc = param.get("DocType"); - String testDocType; - if (doc == null) - testDocType = "all"; - else - testDocType = (String)doc; - - System.out.println("Param was " + doc); - System.out.println("DocType " + testDocType); - if (testDocType.equalsIgnoreCase("writer") || testDocType.equalsIgnoreCase("all")) - checkWriterDoc(); - if (testDocType.equalsIgnoreCase("math") || testDocType.equalsIgnoreCase("all")) - checkMathDoc(); - if (testDocType.equalsIgnoreCase("draw") || testDocType.equalsIgnoreCase("all")) - checkDrawDoc(); - if (testDocType.equalsIgnoreCase("impress") || testDocType.equalsIgnoreCase("all")) - checkImpressDoc(); - if (testDocType.equalsIgnoreCase("calc") || testDocType.equalsIgnoreCase("all")) - checkCalcDoc(); - - } - - /** - * Test the interfaces on a writer document - */ - public void checkWriterDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XTextDocument xTextDoc = null; - try { - log.println("****** Open a new writer document"); - xTextDoc = xSOF.createTextDoc("_blank"); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xTextDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - - /** - * Test the interfaces on a math document - */ - public void checkMathDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XComponent xMathDoc = null; - try { - log.println("****** Open a new math document"); - xMathDoc = xSOF.createMathDoc("_blank"); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xMathDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xMathDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - - /** - * Test the interfaces on a draw document - */ - public void checkDrawDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XComponent xDrawDoc = null; - try { - log.println("****** Open a new draw document"); - xDrawDoc = xSOF.createDrawDoc("_blank"); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xDrawDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xDrawDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - - /** - * Test the interfaces on an impress document - */ - public void checkImpressDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XComponent xImpressDoc = null; - try { - log.println("****** Open a new impress document"); - xImpressDoc = xSOF.createImpressDoc("_blank"); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xImpressDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xImpressDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - /** - * Test the interfaces on an calc document - */ - public void checkCalcDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XSpreadsheetDocument xSpreadsheetDoc = null; - try { - log.println("****** Open a new calc document"); - xSpreadsheetDoc = xSOF.createCalcDoc("_blank"); - shortWait(); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xSpreadsheetDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - - public void getTestObject() { - try { - XInterface xIfc = (XInterface) xMSF.createInstance( - "com.sun.star.awt.Toolkit") ; - XExtendedToolkit tk = (XExtendedToolkit) - UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc); - - shortWait(); - xWindow = (XWindow)UnoRuntime.queryInterface( - XWindow.class,tk.getActiveTopWindow()); - - shortWait(); - AccessibilityTools at = new AccessibilityTools(); - XAccessible xRoot = at.getAccessibleObject(xWindow); - XAccessibleContext parentContext = null; - - log.println("Get the accessible status bar."); - parentContext = at.getAccessibleObjectForRole( - xRoot, AccessibleRole.STATUS_BAR, ""); - shortWait(); - log.println("...OK."); - - XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( - XServiceInfo.class,parentContext); - String[] services = xSI.getSupportedServiceNames(); - log.println("*****"); - log.println("* Implementation Name: " + xSI.getImplementationName()); - for (int i=0; i<services.length; i++) - log.println("* ServiceName "+i+": "+ services[i]); - log.println("*****"); - testObject=parentContext; - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - catch(Throwable t) { - System.out.println("Got throwable:"); - t.printStackTrace(); - } - } - - public void runAllInterfaceTests() { - log.println("*** Now testing XAccessibleComponent ***"); - _XAccessibleComponent _xAccCompTest = - new _XAccessibleComponent(testObject, log); - assure("failed: XAccessibleComponent::getBounds", _xAccCompTest._getBounds()); - assure("failed: XAccessibleComponent::contains", _xAccCompTest._containsPoint()); - assure("failed: XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint()); - assure("failed: XAccessibleComponent::getBackground", _xAccCompTest._getBackground()); - assure("failed: XAccessibleComponent::getForeground", _xAccCompTest._getForeground()); - assure("failed: XAccessibleComponent::getLocation", _xAccCompTest._getLocation()); - assure("failed: XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen()); - assure("failed: XAccessibleComponent::getSize", _xAccCompTest._getSize()); - assure("failed: XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus()); - - log.println("*** Now testing XAccessibleContext ***"); - _XAccessibleContext _xAccContext = - new _XAccessibleContext(testObject, log); - assure("failed: XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount()); - assure("failed: XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild()); - assure("failed: XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription()); - assure("failed: XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName()); - assure("failed: XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent()); - assure("failed: XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent()); - assure("failed: XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet()); - assure("failed: XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole()); - assure("failed: XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet()); - assure("failed: XAccessibleContext::getLocale", _xAccContext._getLocale()); - - log.println("*** Now testing XAccessibleExtendedComponent ***"); - _XAccessibleExtendedComponent _xAccExtComp = - new _XAccessibleExtendedComponent(testObject, log); - assure("failed: XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont()); - assure("failed: XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText()); - assure("failed: XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText()); - - log.println("*** Now testing XAccessibleEventBroadcaster ***"); - _XAccessibleEventBroadcaster _xAccEvBcast = - new _XAccessibleEventBroadcaster(testObject, log, "Pfff", xWindow); - assure("failed: XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener()); - assure("failed: XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener()); - } -} diff --git a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java b/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java deleted file mode 100755 index 36394732ce78..000000000000 --- a/toolkit/qa/complex/toolkit/CheckAccessibleStatusBarItem.java +++ /dev/null @@ -1,385 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.toolkit; - -import complexlib.ComplexTestCase; -import util.SOfficeFactory; -import complexlib.ComplexTestCase; -import util.SOfficeFactory; -import util.AccessibilityTools; -import complex.toolkit.interface_tests._XAccessibleComponent; -import complex.toolkit.interface_tests._XAccessibleContext; -import complex.toolkit.interface_tests._XAccessibleEventBroadcaster; -import complex.toolkit.interface_tests._XAccessibleExtendedComponent; -import complex.toolkit.interface_tests._XAccessibleText; -import com.sun.star.awt.XWindow; -import com.sun.star.chart.XChartDocument; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.sheet.XSpreadsheetDocument; -import com.sun.star.text.XTextDocument; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.util.XCloseable; -import com.sun.star.accessibility.AccessibleRole; -import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleContext; -import com.sun.star.awt.XExtendedToolkit; -import java.io.PrintWriter; -/** - * - */ -public class CheckAccessibleStatusBarItem extends ComplexTestCase { - - XMultiServiceFactory xMSF = null; - XAccessibleContext testObject = null; - XWindow xWindow = null; - - - public String[] getTestMethodNames() { - return new String[]{"checkDocs"};//{"checkWriterDoc", "checkDrawDoc", -// "checkMathDoc", "checkImpressDoc", "checkCalcDoc"}; - } - - /** - * Sleeps for 0.5 sec. to allow StarOffice to react on <code> - * reset</code> call. - */ - private void shortWait() { - shortWait(500) ; - } - - /** - * Sleeps for a certain time. - * @param Thread is sleeping for this time in milliseconds. - */ - private void shortWait(int time) { - try { - Thread.sleep(500); - } catch (InterruptedException e) { - log.println("While waiting :" + e) ; - } - } - - /** - * Check document types - */ - public void checkDocs() { - Object doc = param.get("DocType"); - String testDocType; - if (doc == null) - testDocType = "all"; - else - testDocType = (String)doc; - - System.out.println("Param was " + doc); - System.out.println("DocType " + testDocType); - if (testDocType.equalsIgnoreCase("writer") || testDocType.equalsIgnoreCase("all")) - checkWriterDoc(); - if (testDocType.equalsIgnoreCase("math") || testDocType.equalsIgnoreCase("all")) - checkMathDoc(); - if (testDocType.equalsIgnoreCase("draw") || testDocType.equalsIgnoreCase("all")) - checkDrawDoc(); - if (testDocType.equalsIgnoreCase("impress") || testDocType.equalsIgnoreCase("all")) - checkImpressDoc(); - if (testDocType.equalsIgnoreCase("calc") || testDocType.equalsIgnoreCase("all")) - checkCalcDoc(); - - } - - /** - * Test the interfaces on a writer document - */ - public void checkWriterDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XTextDocument xTextDoc = null; - try { - log.println("****** Open a new writer document"); - xTextDoc = xSOF.createTextDoc("_blank"); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xTextDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xTextDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - - /** - * Test the interfaces on a math document - */ - public void checkMathDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XComponent xMathDoc = null; - try { - log.println("****** Open a new math document"); - xMathDoc = xSOF.createMathDoc("_blank"); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xMathDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xMathDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - - /** - * Test the interfaces on a draw document - */ - public void checkDrawDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XComponent xDrawDoc = null; - try { - log.println("****** Open a new draw document"); - xDrawDoc = xSOF.createDrawDoc("_blank"); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xDrawDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xDrawDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - - /** - * Test the interfaces on an impress document - */ - public void checkImpressDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XComponent xImpressDoc = null; - try { - log.println("****** Open a new impress document"); - xImpressDoc = xSOF.createImpressDoc("_blank"); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xImpressDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xImpressDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - /** - * Test the interfaces on an calc document - */ - public void checkCalcDoc() { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - XSpreadsheetDocument xSpreadsheetDoc = null; - try { - log.println("****** Open a new calc document"); - xSpreadsheetDoc = xSOF.createCalcDoc("_blank"); - shortWait(); - getTestObject(); - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - runAllInterfaceTests(); - - if (xSpreadsheetDoc != null) { - XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xSpreadsheetDoc); - try { - xClose.close(false); - } - catch(com.sun.star.util.CloseVetoException e) { - e.printStackTrace(); - } - } - } - - public void getTestObject() { - try { - XInterface xIfc = (XInterface) xMSF.createInstance( - "com.sun.star.awt.Toolkit") ; - XExtendedToolkit tk = (XExtendedToolkit) - UnoRuntime.queryInterface(XExtendedToolkit.class,xIfc); - - shortWait(); - xWindow = (XWindow)UnoRuntime.queryInterface( - XWindow.class,tk.getActiveTopWindow()); - - shortWait(); - AccessibilityTools at = new AccessibilityTools(); - XAccessible xRoot = at.getAccessibleObject(xWindow); - XAccessibleContext parentContext = null; - - log.println("Get the accessible status bar."); - parentContext = at.getAccessibleObjectForRole( - xRoot, AccessibleRole.STATUS_BAR, ""); - shortWait(); - if ( parentContext == null ) { - log.println("Could not get the test object: set the correct focus in the next 30 seconds."); - shortWait(30000); - parentContext = at.getAccessibleObjectForRole( - xRoot, AccessibleRole.STATUS_BAR, ""); - - if ( parentContext == null ) - failed("Could not create a test object."); - } - log.println("...OK."); - - testObject=parentContext; - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - catch(Throwable t) { - System.out.println("Got throwable:"); - t.printStackTrace(); - } - } - - public void runAllInterfaceTests() { - int count = testObject.getAccessibleChildCount(); - log.println("*****"); - log.println("**** Found items to test: " + count); - for (int i=0;i<count;i++){ - log.println("**** Now testing StatusBarItem " + i + "."); - XAccessible object = null; - try { - object = testObject.getAccessibleChild(i); - } - catch(com.sun.star.lang.IndexOutOfBoundsException e) { - System.out.println("* Cannot get item Nr: " + i); - continue; - } - XServiceInfo xSI = (XServiceInfo)UnoRuntime.queryInterface( - XServiceInfo.class,object); - String[] services = xSI.getSupportedServiceNames(); - log.println("* Implementation Name: " + xSI.getImplementationName()); - String accName = object.getAccessibleContext().getAccessibleName(); - log.println("* Accessible Name: " + accName); - for (int j=0; i<services.length; i++) - log.println("* ServiceName "+i+": "+ services[j]); - log.println("*****"); - - log.println("*** Now testing XAccessibleComponent ***"); - _XAccessibleComponent _xAccCompTest = - new _XAccessibleComponent(object, log); - assure("failed: "+accName+" - XAccessibleComponent::getBounds", _xAccCompTest._getBounds(), true); - assure("failed: "+accName+" - XAccessibleComponent::contains", _xAccCompTest._containsPoint(), true); - assure("failed: "+accName+" - XAccessibleComponent::getAccessibleAt", _xAccCompTest._getAccessibleAtPoint(), true); - assure("failed: "+accName+" - XAccessibleComponent::getBackground", _xAccCompTest._getBackground(), true); - assure("failed: "+accName+" - XAccessibleComponent::getForeground", _xAccCompTest._getForeground(), true); - assure("failed: "+accName+" - XAccessibleComponent::getLocation", _xAccCompTest._getLocation(), true); - assure("failed: "+accName+" - XAccessibleComponent::getLocationOnScreen", _xAccCompTest._getLocationOnScreen(), true); - assure("failed: "+accName+" - XAccessibleComponent::getSize", _xAccCompTest._getSize(), true); - assure("failed: "+accName+" - XAccessibleComponent::grabFocus", _xAccCompTest._grabFocus(), true); - - log.println("*** Now testing XAccessibleContext ***"); - _XAccessibleContext _xAccContext = - new _XAccessibleContext(object, log); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleChildCount", _xAccContext._getAccessibleChildCount(), true); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleChild", _xAccContext._getAccessibleChild(), true); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleDescription", _xAccContext._getAccessibleDescription(), true); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleName", _xAccContext._getAccessibleName(), true); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleParent", _xAccContext._getAccessibleParent(), true); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleIndexInParent", _xAccContext._getAccessibleIndexInParent(), true); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleRelationSet", _xAccContext._getAccessibleRelationSet(), true); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleRole", _xAccContext._getAccessibleRole(), true); - assure("failed: "+accName+" - XAccessibleContext::getAccessibleStateSet", _xAccContext._getAccessibleStateSet(), true); - assure("failed: "+accName+" - XAccessibleContext::getLocale", _xAccContext._getLocale(), true); - - log.println("*** Now testing XAccessibleExtendedComponent ***"); - _XAccessibleExtendedComponent _xAccExtComp = - new _XAccessibleExtendedComponent(object, log); - assure("failed: "+accName+" - XAccessibleExtendedComponent::getFont", _xAccExtComp._getFont(), true); - assure("failed: "+accName+" - XAccessibleExtendedComponent::getTitledBorderText", _xAccExtComp._getTitledBorderText(), true); - assure("failed: "+accName+" - XAccessibleExtendedComponent::getToolTipText", _xAccExtComp._getToolTipText(), true); - - log.println("*** Now testing XAccessibleEventBroadcaster ***"); - _XAccessibleEventBroadcaster _xAccEvBcast = - new _XAccessibleEventBroadcaster(object, log, "Pfff", xWindow); - assure("failed: "+accName+" - XAccessibleEventBroadcaster::addEventListener", _xAccEvBcast._addEventListener(), true); - assure("failed: "+accName+" - XAccessibleEventBroadcaster::removeEventListener", _xAccEvBcast._removeEventListener(), true); - - log.println("*** Now testing XAccessibleText ***"); - _XAccessibleText _xAccText = - new _XAccessibleText(object, log, xMSF, "true"); - assure("failed: "+accName+" - XAccessibleText::getText", _xAccText._getText(), true); - assure("failed: "+accName+" - XAccessibleText::getCharacterCount", _xAccText._getCharacterCount(), true); - assure("failed: "+accName+" - XAccessibleText::getCharacterBounds", _xAccText._getCharacterBounds(), true); - assure("failed: "+accName+" - XAccessibleText::setSelection", _xAccText._setSelection(), true); - assure("failed: "+accName+" - XAccessibleText::copyText", _xAccText._copyText(), true); - assure("failed: "+accName+" - XAccessibleText::getCharacter", _xAccText._getCharacter(), true); - assure("failed: "+accName+" - XAccessibleText::getCharacterAttributes", _xAccText._getCharacterAttributes(), true); - assure("failed: "+accName+" - XAccessibleText::getIndexAtPoint", _xAccText._getIndexAtPoint(), true); - assure("failed: "+accName+" - XAccessibleText::getSelectedText", _xAccText._getSelectedText(), true); - assure("failed: "+accName+" - XAccessibleText::getSelectionEnd", _xAccText._getSelectionEnd(), true); - assure("failed: "+accName+" - XAccessibleText::getSelectionStart", _xAccText._getSelectionStart(), true); - assure("failed: "+accName+" - XAccessibleText::getTextAtIndex", _xAccText._getTextAtIndex(), true); - assure("failed: "+accName+" - XAccessibleText::getTextBeforeIndex", _xAccText._getTextBeforeIndex(), true); - assure("failed: "+accName+" - XAccessibleText::getBehindIndex", _xAccText._getTextBehindIndex(), true); - assure("failed: "+accName+" - XAccessibleText::getTextRange", _xAccText._getTextRange(), true); - assure("failed: "+accName+" - XAccessibleText::setCaretPosition", _xAccText._setCaretPosition(), true); - assure("failed: "+accName+" - XAccessibleText::getCaretPosition", _xAccText._getCaretPosition(), true); - } - } - -} diff --git a/toolkit/qa/complex/toolkit/CheckAsyncCallback.java b/toolkit/qa/complex/toolkit/CheckAsyncCallback.java deleted file mode 100644 index cc184f3c1a73..000000000000 --- a/toolkit/qa/complex/toolkit/CheckAsyncCallback.java +++ /dev/null @@ -1,127 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.toolkit; - -import complexlib.ComplexTestCase; -import util.SOfficeFactory; -import complex.toolkit.interface_tests._XRequestCallback; -import complex.toolkit.CallbackClass; -import com.sun.star.awt.XRequestCallback; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.lang.XComponent; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; -import com.sun.star.awt.XExtendedToolkit; -import java.io.PrintWriter; - -/** - * - */ -public class CheckAsyncCallback extends ComplexTestCase { - - - XInterface testObject = null; - XMultiServiceFactory xMSF = null; - - public String[] getTestMethodNames() { - return new String[]{"checkService"}; - } - -/* public String getTestObjectName() { - return "com.sun.star.awt.AccessibleStatusBar"; - } -*/ - /** - * Sleeps for 0.5 sec. to allow StarOffice to react on <code> - * reset</code> call. - */ - private void shortWait() { - try { - Thread.sleep(500) ; - } catch (InterruptedException e) { - log.println("While waiting :" + e) ; - } - } - - /** - * Check services - */ - public void checkService() { - checkAsyncCallbackService(); - - } - - /** - * Test the interfaces - */ - public void checkAsyncCallbackService() { - runAllInterfaceTests(); - } - - public void getTestObject() { - try { - xMSF = (XMultiServiceFactory)param.getMSF(); - SOfficeFactory xSOF = SOfficeFactory.getFactory(xMSF); - - XRequestCallback xAsyncCallback = null; - - XInterface xIfc = (XInterface)xMSF.createInstance( - "com.sun.star.awt.AsyncCallback" ); - xAsyncCallback = (XRequestCallback) - UnoRuntime.queryInterface(XRequestCallback.class,xIfc); - - testObject=xAsyncCallback; - } - catch(com.sun.star.uno.Exception e) { - e.printStackTrace(); - } - catch(Throwable t) { - System.out.println("Got throwable:"); - t.printStackTrace(); - } - } - - public void runAllInterfaceTests() { - getTestObject(); - log.println("*** Now testing XRequestCallback ***"); - _XRequestCallback _xRequestCallback = - new _XRequestCallback(testObject, log, xMSF ); - assure("failed: XRequestCallback::addCallback", _xRequestCallback._addCallback()); - } - - public void checkCallback() { - getTestObject(); - log.println("*** Now testing asynchronous callback service ***"); - XRequestCallback xAsyncCallback = null; - xAsyncCallback = (XRequestCallback) - UnoRuntime.queryInterface( XRequestCallback.class, testObject ); - CallbackClass aCallbackClass = new CallbackClass( log, xMSF ); - xAsyncCallback.addCallback( aCallbackClass, null ); - } -} diff --git a/toolkit/qa/complex/toolkit/GridControl.java b/toolkit/qa/complex/toolkit/GridControl.java new file mode 100755 index 000000000000..a06a52342417 --- /dev/null +++ b/toolkit/qa/complex/toolkit/GridControl.java @@ -0,0 +1,687 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2011 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + *************************************************************************/ + +package complex.toolkit; + +import com.sun.star.awt.XControl; +import com.sun.star.awt.XControlContainer; +import com.sun.star.awt.XControlModel; +import com.sun.star.awt.XToolkit; +import com.sun.star.awt.grid.DefaultGridDataModel; +import com.sun.star.awt.grid.XGridColumn; +import com.sun.star.awt.grid.XGridColumnModel; +import com.sun.star.awt.grid.XGridDataModel; +import com.sun.star.awt.grid.XMutableGridDataModel; +import com.sun.star.awt.grid.XSortableMutableGridDataModel; +import com.sun.star.beans.Pair; +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.ContainerEvent; +import com.sun.star.container.XContainerListener; +import com.sun.star.container.XNameContainer; +import com.sun.star.lang.EventObject; +import com.sun.star.lang.IndexOutOfBoundsException; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XEventListener; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.Exception; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XCloneable; +import complex.toolkit.awtgrid.DummyColumn; +import complex.toolkit.awtgrid.TMutableGridDataModel; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Random; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import static org.junit.Assert.*; +import org.openoffice.test.OfficeConnection; + +/** is a unit test for the grid control related implementations + * @author frank.schoenheit@sun.com + */ +public class GridControl +{ + // ----------------------------------------------------------------------------------------------------------------- + public GridControl() + { + m_context = m_connection.getComponentContext(); + } + + // ----------------------------------------------------------------------------------------------------------------- + private static void impl_dispose( final Object... i_components ) + { + for ( int i=0; i<i_components.length; ++i ) + { + if ( i_components[i] != null ) + { + final XComponent component = UnoRuntime.queryInterface( XComponent.class, i_components[i] ); + component.dispose(); + } + } + } + + // ----------------------------------------------------------------------------------------------------------------- + private void impl_recreateGridModel() throws Exception + { + impl_dispose( m_gridControlModel, m_columnModel, m_dataModel ); + + // create a grid control model, and ensure it has a proper data and column model already + m_gridControlModel = UnoRuntime.queryInterface( XPropertySet.class, + createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) ); + assertNotNull( "grid control model does not provide XPropertySet interface", m_gridControlModel ); + + // ensure that the model has default column/data models + m_columnModel = UnoRuntime.queryInterface( XGridColumnModel.class, m_gridControlModel.getPropertyValue( "ColumnModel" ) ); + assertNotNull( "the control model is expected to have an initial column model", m_columnModel ); + final XGridDataModel dataModel = UnoRuntime.queryInterface( XGridDataModel.class, m_gridControlModel.getPropertyValue( "GridDataModel" ) ); + assertNotNull( "the control model is expected to have an initial data model", dataModel ); + m_dataModel = UnoRuntime.queryInterface( XSortableMutableGridDataModel.class, + dataModel ); + assertNotNull( "the out-of-the-box data model should be mutable and sortable", m_dataModel ); + } + + // ----------------------------------------------------------------------------------------------------------------- + @Test + public void testGridControlCloning() throws Exception + { + impl_recreateGridModel(); + + // give the test something to compare, actually + XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class, + m_gridControlModel.getPropertyValue( "ColumnModel" ) ); + columnModel.setDefaultColumns( 10 ); + + // clone the grid model + final XCloneable cloneable = UnoRuntime.queryInterface( XCloneable.class, m_gridControlModel ); + assertNotNull( "all UnoControlModel's are expected to be cloneable", cloneable ); + + final XInterface clone = cloneable.createClone(); + final XPropertySet clonedProps = UnoRuntime.queryInterface( XPropertySet.class, clone ); + + // TODO: check all those generic properties for equality + + // the data model and the column model should have been cloned, too + // in particular, the clone should not share the sub models with the orignal + final XMutableGridDataModel originalDataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class, + m_gridControlModel.getPropertyValue( "GridDataModel" ) ); + final XMutableGridDataModel clonedDataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class, + clonedProps.getPropertyValue( "GridDataModel" ) ); + assertFalse( "data model should not be shared after cloning", UnoRuntime.areSame( originalDataModel, clonedDataModel ) ); + impl_assertEquality( originalDataModel, clonedDataModel ); + + final XGridColumnModel originalColumnModel = columnModel; + final XGridColumnModel clonedColumnModel = UnoRuntime.queryInterface( XGridColumnModel.class, + clonedProps.getPropertyValue( "ColumnModel" ) ); + assertFalse( "column model should not be shared after cloning", UnoRuntime.areSame( originalColumnModel, clonedColumnModel ) ); + impl_assertEquality( originalColumnModel, clonedColumnModel ); + } + + // ----------------------------------------------------------------------------------------------------------------- + @Test + public void testDisposal() throws Exception + { + impl_recreateGridModel(); + + final int columnCount = 3; + m_columnModel.setDefaultColumns( columnCount ); + + // add disposal listeners to all columns so far + final XGridColumn[] columns = m_columnModel.getColumns(); + assertEquals( "creating default columns resulted in unexpected column count", columnCount, columns.length ); + final DisposeListener[] columnListeners = new DisposeListener[columnCount]; + for ( int i=0; i<columnCount; ++i ) + columnListeners[i] = new DisposeListener( columns[i] ); + + // add another column, and check that upon removal, it is disposed + final int newColumnIndex = m_columnModel.addColumn( m_columnModel.createColumn() ); + final DisposeListener columnListener = new DisposeListener( m_columnModel.getColumn( newColumnIndex ) ); + m_columnModel.removeColumn( newColumnIndex ); + assertTrue( "explicit column removal is expected to dispose the column", columnListener.isDisposed() ); + + // by definition, the grid control model is the owner of both the column and the data model. So, setting + // a new column/data model should implicitly dispose the old models + final DisposeListener oldDataModelListener = new DisposeListener( m_dataModel ); + final DisposeListener oldColumnModelListener = new DisposeListener( m_columnModel ); + + final Object newDataModel = createInstance( "com.sun.star.awt.grid.DefaultGridDataModel" ); + final Object newColumnModel = createInstance( "com.sun.star.awt.grid.DefaultGridColumnModel" ); + final DisposeListener newDataModelListener = new DisposeListener( newDataModel ); + final DisposeListener newColumnModelListener = new DisposeListener( newColumnModel ); + + m_gridControlModel.setPropertyValue( "GridDataModel", newDataModel ); + assertTrue( "setting a new data model failed", impl_areSameInterface( newDataModel, m_gridControlModel.getPropertyValue( "GridDataModel" ) ) ); + m_gridControlModel.setPropertyValue( "ColumnModel", newColumnModel ); + assertTrue( "setting a new column model failed", impl_areSameInterface( newColumnModel, m_gridControlModel.getPropertyValue( "ColumnModel" ) ) ); + + assertTrue( "old data model has not been disposed", oldDataModelListener.isDisposed() ); + assertTrue( "old column model has not been disposed", oldColumnModelListener.isDisposed() ); + for ( int i=0; i<columnCount; ++i ) + assertTrue( "column no. " + i + " has not been disposed", columnListeners[i].isDisposed() ); + + // the same holds if the grid control model itself is disposed - it should dispose the depending models, too + assertFalse( "new data model is already disposed - this is unexpected", newDataModelListener.isDisposed() ); + assertFalse( "new column model is already disposed - this is unexpected", newColumnModelListener.isDisposed() ); + impl_dispose( m_gridControlModel ); + assertTrue( "new data model is not disposed after disposing the grid column model", newDataModelListener.isDisposed() ); + assertTrue( "new column model is not disposed after disposing the grid column model", newColumnModelListener.isDisposed() ); + } + + // ----------------------------------------------------------------------------------------------------------------- + /** + * tests various aspects of the <code>XMutableGridDataModel</code> interface + */ + @Test + public void testMutableGridDataModel() throws Exception + { + impl_recreateGridModel(); + + TMutableGridDataModel test = new TMutableGridDataModel( m_dataModel ); + test.testAddRow(); + test.testAddRows(); + test.testRemoveRow(); + test.testRemoveAllRows(); + test.testUpdateCellData(); + test.testUpdateRowData(); + test.testUpdateRowHeading(); + test.cleanup(); + + // a somehwat less straight-forward test: the data model is expected to implicitly increase its column count + // when you add a row which has more columns than currently known + final XMutableGridDataModel dataModel = DefaultGridDataModel.create( m_context ); + dataModel.addRow( 0, new Object[] { 1 } ); + assertEquals( "unexpected column count after adding the most simple row", 1, dataModel.getColumnCount() ); + dataModel.addRow( 1, new Object[] { 1, 2 } ); + assertEquals( "implicit extension of the column count doesn't work", 2, dataModel.getColumnCount() ); + } + + // ----------------------------------------------------------------------------------------------------------------- + @Test + public void testGridColumnModel() throws Exception + { + impl_recreateGridModel(); + + ColumnModelListener listener = new ColumnModelListener(); + m_columnModel.addContainerListener( listener ); + + // insert default columns into the previously empty model, ensure we get the right notifications + final int defaultColumnsCount = 3; + m_columnModel.setDefaultColumns( defaultColumnsCount ); + impl_assertColumnModelConsistency(); + List< ContainerEvent > events = listener.assertExclusiveInsertionEvents(); + listener.reset(); + assertEquals( "wrong number of events fired by setDefaulColumns", defaultColumnsCount, events.size() ); + for ( int i=0; i<defaultColumnsCount; ++i ) + { + final ContainerEvent event = events.get(i); + final int index = impl_assertInteger( event.Accessor ); + assertEquals( "unexpected Accessor value in insert notification", i, index ); + assertTrue( "wrong column object notified in insert notification", + impl_areSameInterface( event.Element, m_columnModel.getColumn(i) ) ); + } + + // insert some more default columns, ensure that all previously existing columns are removed + final int moreDefaultColumnsCount = 5; + m_columnModel.setDefaultColumns( moreDefaultColumnsCount ); + impl_assertColumnModelConsistency(); + assertEquals( "setting default columns is expected to remove all previously existing columns", + moreDefaultColumnsCount, m_columnModel.getColumnCount() ); + + // in this situation, both removal and insertion events have been notified + final List< ContainerEvent > removalEvents = listener.getRemovalEvents(); + final List< ContainerEvent > insertionEvents = listener.getInsertionEvents(); + listener.reset(); + + // for the removal events, check the indexes + assertEquals( "wrong number of columns removed (or notified) upon setting default columns", + defaultColumnsCount, removalEvents.size() ); + for ( int i=0; i<removalEvents.size(); ++i ) + { + final ContainerEvent event = removalEvents.get(i); + final int removedIndex = impl_assertInteger( event.Accessor ); + + // The implementation is allowed to remove the columns from the beginning, in which case the + // index of the removed column must always be 0, since e.g. the second column has index 0 + // after the first column (which previously had index 0) had been removed. + // Alternatively, the implementation is allowed to remove columns from the end, which means + // that the column index given in the event is steadily increasing. + assertTrue( "unexpected column removal event column index", + ( removedIndex == 0 ) || ( removedIndex == removalEvents.size() - 1 - i ) ); + } + + // for the insertion events, check the indexes as well + assertEquals( "wrong number of insertion events when setting default columns over existing columns", + moreDefaultColumnsCount, insertionEvents.size() ); + for ( int i=0; i<insertionEvents.size(); ++i ) + { + final ContainerEvent event = insertionEvents.get(i); + final int index = impl_assertInteger( event.Accessor ); + assertEquals( i, index ); + } + + // okay, remove all those columns + while ( m_columnModel.getColumnCount() != 0 ) + { + final int columnCount = m_columnModel.getColumnCount(); + final int removeColumnIndex = m_randomGenerator.nextInt( columnCount ); + m_columnModel.removeColumn( removeColumnIndex ); + events = listener.assertExclusiveRemovalEvents(); + listener.reset(); + assertEquals( "removing a single column should notify a single event", 1, events.size() ); + final ContainerEvent event = events.get(0); + final int removalIndex = impl_assertInteger( event.Accessor ); + assertEquals( "removing an arbitrary column does not notify the proper accessor", + removeColumnIndex, removalIndex ); + } + + // calling addColumn with a column not created by the given model/implementatoion should not succeed + boolean caughtExpected = false; + try + { + m_columnModel.addColumn( new DummyColumn() ); + } + catch( final com.sun.star.lang.IllegalArgumentException e ) + { + assertTrue( impl_areSameInterface( e.Context, m_columnModel ) ); + caughtExpected = true; + } + assertTrue( "adding a dummy (self-implemented) grid column to the model should not succeed", caughtExpected ); + + // adding a single column to the end should succeed, properly notify, and still be consistent + final XGridColumn newColumn = m_columnModel.createColumn(); + m_columnModel.addColumn( newColumn ); + impl_assertColumnModelConsistency(); + events = listener.assertExclusiveInsertionEvents(); + listener.reset(); + assertEquals( "addColumn notifies the wrong number of insertion events", 1, events.size() ); + final int insertionIndex = impl_assertInteger( events.get(0).Accessor ); + assertEquals( insertionIndex, newColumn.getIndex() ); + } + + // ----------------------------------------------------------------------------------------------------------------- + @Test + public void testSortableDataModel() throws Exception + { + impl_recreateGridModel(); + + final int colCount = 3; + final int rowCount = 10; + // initialize with some data + final Object[][] data = new Object[][] { + new Object[] { 15, 17, 0 }, + new Object[] { 9, 8, 14 }, + new Object[] { 17, 2, 16 }, + new Object[] { 0, 7, 14 }, + new Object[] { 10, 16, 16 }, + new Object[] { 2, 8, 10 }, + new Object[] { 4, 8, 3 }, + new Object[] { 7, 9, 0 }, + new Object[] { 15, 6, 19 }, + new Object[] { 2, 14, 19 } + }; + final Object[] rowHeadings = new Object[] { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 + }; + // ensure consistency of the test data + assertEquals( rowHeadings.length, rowCount ); + assertEquals( data.length, rowCount ); + for ( Object[] rowData : data ) + assertEquals( rowData.length, colCount ); + + // add the test data + m_dataModel.addRows( rowHeadings, data ); + assertEquals( rowCount, m_dataModel.getRowCount() ); + assertEquals( colCount, m_dataModel.getColumnCount() ); + + // sort by each column + for ( int colIndex = 0; colIndex < colCount; ++colIndex ) + { + for ( boolean ascending : new boolean[] { true, false } ) + { + m_dataModel.sortByColumn( colIndex, ascending ); + Pair currentSortOrder = m_dataModel.getCurrentSortOrder(); + assertEquals( "invalid current sort column (column " + colIndex + ")", ((Integer)currentSortOrder.First).intValue(), colIndex ); + assertEquals( "invalid current sort direction", ((Boolean)currentSortOrder.Second).booleanValue(), ascending ); + + /*for ( int i=0; i<rowCount; ++i ) + { + for ( int j=0; j<colCount; ++j ) + System.out.print( m_dataModel.getCellData( j, i ).toString() + ", " ); + System.out.println(); + }*/ + + // verify the data is actually sorted by this column + for ( int rowIndex = 0; rowIndex < rowCount - 1; ++rowIndex ) + { + final Object currentValue = m_dataModel.getCellData( colIndex, rowIndex ); + final int currentIntValue = impl_assertInteger( currentValue ); + final Object nextValue = m_dataModel.getCellData( colIndex, rowIndex + 1 ); + final int nextIntValue = impl_assertInteger( nextValue ); + assertTrue( "data in row " + rowIndex + " is actually not sorted " + ( ascending ? "ascending" : "descending" ), + ascending ? currentIntValue <= nextIntValue + : currentIntValue >= nextIntValue ); + + // ensure the data in the other columns, and the row headings, are sorted as well + final Object rowHeading = m_dataModel.getRowHeading( rowIndex ); + final int unsortedRowIndex = impl_assertInteger( rowHeading ); + for ( int innerColIndex = 0; innerColIndex < colCount; ++innerColIndex ) + { + assertEquals( "sorted row " + rowIndex + ", unsorted row " + unsortedRowIndex + ", col " + innerColIndex + + ": wrong data", + data[unsortedRowIndex][innerColIndex], m_dataModel.getCellData( innerColIndex, rowIndex ) ); + } + } + } + } + } + + // ----------------------------------------------------------------------------------------------------------------- + @Test + public void testModelViewInteraction() throws Exception + { + final List< Object > disposables = new ArrayList< Object >(); + try + { + // create a siple dialog model/control/peer trinity + final XControlModel dialogModel = createInstance( XControlModel.class, "com.sun.star.awt.UnoControlDialogModel" ); + disposables.add( dialogModel ); + final XPropertySet dialogProps = UnoRuntime.queryInterface( XPropertySet.class, dialogModel ); + dialogProps.setPropertyValue( "Width", 200 ); + dialogProps.setPropertyValue( "Height", 100 ); + dialogProps.setPropertyValue( "Title", "Grid Control Unit Test" ); + final XControl dialogControl = createInstance( XControl.class, "com.sun.star.awt.UnoControlDialog" ); + disposables.add( dialogControl ); + dialogControl.setModel( dialogModel ); + dialogControl.createPeer( createInstance( XToolkit.class, "com.sun.star.awt.Toolkit" ), null ); + + // insert a grid control model + final XMultiServiceFactory controlModelFactory = UnoRuntime.queryInterface( XMultiServiceFactory.class, + dialogModel ); + XPropertySet gridModelProps = UnoRuntime.queryInterface( XPropertySet.class, + controlModelFactory.createInstance( "com.sun.star.awt.grid.UnoControlGridModel" ) ); + disposables.add( gridModelProps ); + gridModelProps.setPropertyValue( "PositionX", 6 ); + gridModelProps.setPropertyValue( "PositionY", 6 ); + gridModelProps.setPropertyValue( "Width", 188 ); + gridModelProps.setPropertyValue( "Height", 88 ); + final XNameContainer modelContainer = UnoRuntime.queryInterface( XNameContainer.class, dialogModel ); + modelContainer.insertByName( "grid", gridModelProps ); + + // check the respective control has been created + final XControlContainer controlContainer = UnoRuntime.queryInterface( XControlContainer.class, dialogControl ); + final XControl gridControl = controlContainer.getControl( "grid" ); + assertNotNull( "no grid control created in the dialog", gridControl ); + + // in the current implementation (not sure this is a good idea at all), the control (more precise: the peer) + // ensures that if there are no columns in the column model, but in the data model, then the column model + // will implicitly have the needed columns added. + // To ensure that clients which rely on this do not break in the future, check this here. + final XMutableGridDataModel dataModel = UnoRuntime.queryInterface( XMutableGridDataModel.class, + gridModelProps.getPropertyValue( "GridDataModel" ) ); + assertNotNull( dataModel ); + assertEquals( 0, dataModel.getColumnCount() ); + + final XGridColumnModel columnModel = UnoRuntime.queryInterface( XGridColumnModel.class, + gridModelProps.getPropertyValue( "ColumnModel" ) ); + assertNotNull( columnModel ); + assertEquals( 0, columnModel.getColumnCount() ); + + dataModel.addRow( null, new Object[] { 1, 2, 3 } ); + assertEquals( 3, dataModel.getColumnCount() ); + assertEquals( 3, columnModel.getColumnCount() ); + } + finally + { + impl_dispose( disposables.toArray()); + } + } + + // ----------------------------------------------------------------------------------------------------------------- + private int impl_assertInteger( final Object i_object ) + { + assertTrue( i_object instanceof Integer ); + return ((Integer)i_object).intValue(); + } + + // ----------------------------------------------------------------------------------------------------------------- + private void impl_assertColumnModelConsistency() throws IndexOutOfBoundsException + { + for ( int col = 0; col < m_columnModel.getColumnCount(); ++col ) + { + final XGridColumn column = m_columnModel.getColumn( col ); + assertNotNull( column ); + assertEquals( "column/model inconsistency: column " + col + " has a wrong index!", col, column.getIndex() ); + } + + final XGridColumn[] allColumns = m_columnModel.getColumns(); + assertEquals( "getColumns returns the wrong number of column objects", + m_columnModel.getColumnCount(), allColumns.length ); + for ( int col = 0; col < m_columnModel.getColumnCount(); ++col ) + { + assertTrue( "getColumns inconsistency", impl_areSameInterface( allColumns[col], m_columnModel.getColumn(col) ) ); + } + } + + // ----------------------------------------------------------------------------------------------------------------- + private void impl_assertEquality( final XGridDataModel i_reference, final XGridDataModel i_compare ) throws IndexOutOfBoundsException + { + assertNotNull( i_reference ); + assertNotNull( i_compare ); + + assertEquals( "data model comparison: wrong column counts", i_reference.getColumnCount(), i_compare.getColumnCount() ); + assertEquals( "data model comparison: wrong row counts", i_reference.getRowCount(), i_compare.getRowCount() ); + + for ( int row = 0; row < i_reference.getRowCount(); ++row ) + { + assertEquals( "data model comparison: wrong row heading content in row " + row, + i_reference.getRowHeading( row ) ); + for ( int col = 0; col < i_reference.getRowCount(); ++col ) + { + assertEquals( "data model comparison: wrong cell content in cell (" + col + ", " + row + ")", + i_reference.getCellData( col, row ) ); + assertEquals( "data model comparison: wrong tooltip content in cell (" + col + ", " + row + ")", + i_reference.getCellToolTip( col, row ) ); + } + } + } + + // ----------------------------------------------------------------------------------------------------------------- + private void impl_assertEquality( final XGridColumnModel i_reference, final XGridColumnModel i_compare ) throws IndexOutOfBoundsException + { + assertEquals( "column model comparison: wrong column counts", i_reference.getColumnCount(), i_compare.getColumnCount() ); + for ( int col = 0; col < i_reference.getColumnCount(); ++col ) + { + final XGridColumn referenceColumn = i_reference.getColumn( col ); + final XGridColumn compareColumn = i_compare.getColumn( col ); + impl_assertEquality( referenceColumn, compareColumn ); + } + } + + // ----------------------------------------------------------------------------------------------------------------- + private void impl_assertEquality( final XGridColumn i_reference, final XGridColumn i_compare ) + { + final Method[] methods = XGridColumn.class.getMethods(); + for ( int m=0; m<methods.length; ++m ) + { + if ( !methods[m].getName().startsWith( "get" ) ) + continue; + try + { + final Object referenceValue = methods[m].invoke( i_reference ); + final Object compareValue = methods[m].invoke( i_compare ); + assertEquals( "grid column comparison: column attribute '" + methods[m].getName().substring(3) + "' does not match", + referenceValue, compareValue ); + } + catch ( java.lang.Exception ex ) + { + fail( " could not retrieve object attributes: " + ex.toString() ); + } + } + } + + // ----------------------------------------------------------------------------------------------------------------- + private boolean impl_areSameInterface( final Object i_lhs, final Object i_rhs ) + { + final XInterface lhs = UnoRuntime.queryInterface( XInterface.class, i_lhs ); + final XInterface rhs = UnoRuntime.queryInterface( XInterface.class, i_rhs ); + return UnoRuntime.areSame( lhs, rhs ); + } + + // ----------------------------------------------------------------------------------------------------------------- + @BeforeClass + public static void setUpConnection() throws java.lang.Exception + { + System.out.println( "--------------------------------------------------------------------------------" ); + System.out.println( "starting class: " + GridControl.class.getName() ); + System.out.print( "connecting ... " ); + m_connection.setUp(); + System.out.println( "done."); + + final long seed = m_randomGenerator.nextLong(); + m_randomGenerator.setSeed( seed ); + System.out.println( "seeding random number generator with " + seed ); + } + + // ----------------------------------------------------------------------------------------------------------------- + @AfterClass + public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println(); + System.out.println( "tearing down connection" ); + m_connection.tearDown(); + System.out.println( "finished class: " + GridControl.class.getName() ); + System.out.println( "--------------------------------------------------------------------------------" ); + } + + // ----------------------------------------------------------------------------------------------------------------- + public <T> T createInstance( Class<T> i_interfaceClass, final String i_serviceIndentifer ) throws Exception + { + return UnoRuntime.queryInterface( i_interfaceClass, createInstance( i_serviceIndentifer ) ); + } + + // ----------------------------------------------------------------------------------------------------------------- + private Object createInstance( final String i_serviceName ) throws Exception + { + Object instance = m_context.getServiceManager().createInstanceWithContext( i_serviceName, m_context ); + assertNotNull( "could not create an instance of '" + i_serviceName + "'", instance ); + return instance; + } + // ----------------------------------------------------------------------------------------------------------------- + private static final class DisposeListener implements XEventListener + { + DisposeListener( final Object i_component ) + { + m_component = UnoRuntime.queryInterface( XComponent.class, i_component ); + assertNotNull( m_component ); + m_component.addEventListener( this ); + } + + public void disposing( EventObject i_event ) + { + assertTrue( UnoRuntime.areSame( i_event.Source, m_component ) ); + m_isDisposed = true; + } + + final boolean isDisposed() { return m_isDisposed; } + + private final XComponent m_component; + private boolean m_isDisposed; + }; + + // ----------------------------------------------------------------------------------------------------------------- + private static final class ColumnModelListener implements XContainerListener + { + ColumnModelListener() + { + } + + public void elementInserted( ContainerEvent i_event ) + { + m_insertionEvents.add( i_event ); + } + + public void elementRemoved( ContainerEvent i_event ) + { + m_removalEvents.add( i_event ); + } + + public void elementReplaced( ContainerEvent i_event ) + { + m_replacementEvents.add( i_event ); + } + + public void disposing( EventObject eo ) + { + m_isDisposed = true; + } + + private List< ContainerEvent > assertExclusiveInsertionEvents() + { + assertFalse( m_insertionEvents.isEmpty() ); + assertTrue( m_removalEvents.isEmpty() ); + assertTrue( m_replacementEvents.isEmpty() ); + return m_insertionEvents; + } + + private List< ContainerEvent > assertExclusiveRemovalEvents() + { + assertTrue( m_insertionEvents.isEmpty() ); + assertFalse( m_removalEvents.isEmpty() ); + assertTrue( m_replacementEvents.isEmpty() ); + return m_removalEvents; + } + + private void reset() + { + m_insertionEvents = new ArrayList< ContainerEvent >(); + m_removalEvents = new ArrayList< ContainerEvent >(); + m_replacementEvents = new ArrayList< ContainerEvent >(); + } + + private List< ContainerEvent > getInsertionEvents() { return m_insertionEvents; } + private List< ContainerEvent > getRemovalEvents() { return m_removalEvents; } + + final boolean isDisposed() { return m_isDisposed; } + + private List< ContainerEvent > m_insertionEvents = new ArrayList< ContainerEvent >(); + private List< ContainerEvent > m_removalEvents = new ArrayList< ContainerEvent >(); + private List< ContainerEvent > m_replacementEvents = new ArrayList< ContainerEvent >(); + private boolean m_isDisposed = false; + }; + + // ----------------------------------------------------------------------------------------------------------------- + private static final OfficeConnection m_connection = new OfficeConnection(); + private static Random m_randomGenerator = new Random(); + private final XComponentContext m_context; + + private XPropertySet m_gridControlModel; + private XGridColumnModel m_columnModel; + private XSortableMutableGridDataModel m_dataModel; +} diff --git a/toolkit/qa/complex/toolkit/UnitConversion.java b/toolkit/qa/complex/toolkit/UnitConversion.java new file mode 100644 index 000000000000..b4cf8a8e1490 --- /dev/null +++ b/toolkit/qa/complex/toolkit/UnitConversion.java @@ -0,0 +1,247 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package complex.toolkit; + +import com.sun.star.awt.XUnitConversion; +import com.sun.star.uno.UnoRuntime; + +import com.sun.star.awt.XWindow; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.awt.XWindowPeer; + +import util.DesktopTools; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; +import static org.junit.Assert.*; + +/** + * This complex test is only for testing the com.sun.star.awt.XUnitConversion methods + * These are converter methods to get the size of a well known awt component + * in a com.sun.star.util.MeasureUnit you want. + * You don't need to know the factors to calculate by hand. + * + * @author ll93751 + */ +public class UnitConversion +{ + /** + * returns the delta value between a and b + * @param a + * @param b + * @return + */ + private int delta(int a, int b) + { + final int n = Math.abs(a - b); + return n; + } + + private XUnitConversion m_xConversion = null; + + /** + * Not really a check, + * only a simple test call to convertSizeToLogic(...) with different parameters + * @param _aSize + * @param _aMeasureUnit + * @param _sEinheit + */ + private void checkSize(com.sun.star.awt.Size _aSize, short _aMeasureUnit, String _sEinheit) + { + try + { + com.sun.star.awt.Size aSizeIn = m_xConversion.convertSizeToLogic(_aSize, _aMeasureUnit); + System.out.println("Window size:"); + System.out.println("Width:" + aSizeIn.Width + " " + _sEinheit); + System.out.println("Height:" + aSizeIn.Height + " " + _sEinheit); + System.out.println(""); + } + catch (com.sun.star.lang.IllegalArgumentException e) + { + System.out.println("Caught IllegalArgumentException in convertSizeToLogic with '" + _sEinheit + "' " + e.getMessage()); + } + } + + /** + * The real test function + * 1. try to get the XMultiServiceFactory of an already running office. Therefore make sure an (open|star)office is running with + * parameters like -accept="socket,host=localhost,port=8100;urp;" + * 2. try to create an empty window + * 3. try to convert the WindowPeer to an XWindow + * 4. try to resize and move the window to an other position, so we get a well knowing position and size. + * 5. run some more tests + * + * If no test fails, the test is well done and returns with 'PASSED, OK' + * + */ + @Test + public void testXUnitConversion() + { + final XMultiServiceFactory xMSF = UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + + assertNotNull("failed: There is no office.", xMSF); + + // create a window + XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF); + assertNotNull("failed: there is no window peer", xWindowPeer); + + + // resize and move the window to a well known position and size + XWindow xWindow = UnoRuntime.queryInterface(XWindow.class, xWindowPeer); + assertNotNull("failed: there is no window, cast wrong?", xWindow); + + xWindow.setVisible(Boolean.TRUE); + + int x = 100; + int y = 100; + int width = 640; + int height = 480; + xWindow.setPosSize(x, y, width, height, com.sun.star.awt.PosSize.POSSIZE); + + com.sun.star.awt.Rectangle aRect = xWindow.getPosSize(); + com.sun.star.awt.Point aPoint = new com.sun.star.awt.Point(aRect.X, aRect.Y); + com.sun.star.awt.Size aSize = new com.sun.star.awt.Size(aRect.Width, aRect.Height); + + System.out.println("Window position and size in pixel:"); + System.out.println("X:" + aPoint.X); + System.out.println("Y:" + aPoint.Y); + System.out.println("Width:" + aSize.Width); + System.out.println("Height:" + aSize.Height); + System.out.println(""); + + assertTrue("Window pos size wrong", aSize.Width == width && aSize.Height == height && aPoint.X == x && aPoint.Y == y); + + m_xConversion = UnoRuntime.queryInterface(XUnitConversion.class, xWindowPeer); + + // try to get the position of the window in 1/100mm with the XUnitConversion method + try + { + com.sun.star.awt.Point aPointInMM_100TH = m_xConversion.convertPointToLogic(aPoint, com.sun.star.util.MeasureUnit.MM_100TH); + System.out.println("Window position:"); + System.out.println("X:" + aPointInMM_100TH.X + " 1/100mm"); + System.out.println("Y:" + aPointInMM_100TH.Y + " 1/100mm"); + System.out.println(""); + } + catch (com.sun.star.lang.IllegalArgumentException e) + { + fail("failed: IllegalArgumentException caught in convertPointToLogic " + e.getMessage()); + } + + // try to get the size of the window in 1/100mm with the XUnitConversion method + com.sun.star.awt.Size aSizeInMM_100TH = null; + com.sun.star.awt.Size aSizeInMM_10TH = null; + try + { + aSizeInMM_100TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_100TH); + System.out.println("Window size:"); + System.out.println("Width:" + aSizeInMM_100TH.Width + " 1/100mm"); + System.out.println("Height:" + aSizeInMM_100TH.Height + " 1/100mm"); + System.out.println(""); + + // try to get the size of the window in 1/10mm with the XUnitConversion method + + aSizeInMM_10TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_10TH); + System.out.println("Window size:"); + System.out.println("Width:" + aSizeInMM_10TH.Width + " 1/10mm"); + System.out.println("Height:" + aSizeInMM_10TH.Height + " 1/10mm"); + System.out.println(""); + + // check the size with a delta which must be smaller a given difference + assertTrue("Size.Width not correct", delta(aSizeInMM_100TH.Width, aSizeInMM_10TH.Width * 10) < 10); + assertTrue("Size.Height not correct", delta(aSizeInMM_100TH.Height, aSizeInMM_10TH.Height * 10) < 10); + + // new + checkSize(aSize, com.sun.star.util.MeasureUnit.PIXEL, "pixel"); + checkSize(aSize, com.sun.star.util.MeasureUnit.APPFONT, "appfont"); + checkSize(aSize, com.sun.star.util.MeasureUnit.SYSFONT, "sysfont"); + + // simply check some more parameters + checkSize(aSize, com.sun.star.util.MeasureUnit.MM, "mm"); + checkSize(aSize, com.sun.star.util.MeasureUnit.CM, "cm"); + checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_1000TH, "1/1000inch"); + checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_100TH, "1/100inch"); + checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_10TH, "1/10inch"); + checkSize(aSize, com.sun.star.util.MeasureUnit.INCH, "inch"); + // checkSize(aSize, com.sun.star.util.MeasureUnit.M, "m"); + checkSize(aSize, com.sun.star.util.MeasureUnit.POINT, "point"); + checkSize(aSize, com.sun.star.util.MeasureUnit.TWIP, "twip"); + // checkSize(aSize, com.sun.star.util.MeasureUnit.KM, "km"); + // checkSize(aSize, com.sun.star.util.MeasureUnit.PICA, "pica"); + // checkSize(aSize, com.sun.star.util.MeasureUnit.FOOT, "foot"); + // checkSize(aSize, com.sun.star.util.MeasureUnit.MILE, "mile"); + } + catch (com.sun.star.lang.IllegalArgumentException e) + { + fail("failed: IllegalArgumentException caught in convertSizeToLogic " + e.getMessage()); + } + + // convert the 1/100mm window size back to pixel + try + { + com.sun.star.awt.Size aNewSize = m_xConversion.convertSizeToPixel(aSizeInMM_100TH, com.sun.star.util.MeasureUnit.MM_100TH); + System.out.println("Window size:"); + System.out.println("Width:" + aNewSize.Width + " pixel"); + System.out.println("Height:" + aNewSize.Height + " pixel"); + + // assure the pixels are the same as we already know + assertTrue("failed: Size from pixel to 1/100mm to pixel", aSize.Width == aNewSize.Width && aSize.Height == aNewSize.Height); + } + catch (com.sun.star.lang.IllegalArgumentException e) + { + fail("failed: IllegalArgumentException caught in convertSizeToPixel " + e.getMessage()); + } + + // close the window. + // IMHO a little bit stupid, but the XWindow doesn't support a XCloseable interface + xWindow.dispose(); + } + + @BeforeClass + public static void setUpConnection() throws Exception + { + System.out.println( "--------------------------------------------------------------------------------" ); + System.out.println( "starting class: " + UnitConversion.class.getName() ); + System.out.println( "connecting ..." ); + connection.setUp(); + } + + @AfterClass + public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println(); + System.out.println( "tearing down connection" ); + connection.tearDown(); + System.out.println( "finished class: " + UnitConversion.class.getName() ); + System.out.println( "--------------------------------------------------------------------------------" ); + } + + private static final OfficeConnection connection = new OfficeConnection(); +} diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java index 5c3a58c35f16..d1025979a0bf 100644 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleComponent.java +++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleComponent.java @@ -25,9 +25,8 @@ * ************************************************************************/ -package complex.toolkit.interface_tests; +package complex.toolkit.accessibility; -import share.LogWriter; import com.sun.star.awt.Point; import com.sun.star.awt.Rectangle; import com.sun.star.awt.Size; @@ -56,7 +55,7 @@ import java.util.Vector; */ public class _XAccessibleComponent { - private LogWriter log; + // private LogWriter log; public XAccessibleComponent oObj = null; @@ -67,11 +66,12 @@ public class _XAccessibleComponent { /** * Constructor + * @param object */ - public _XAccessibleComponent(XInterface object, LogWriter log) { - oObj = (XAccessibleComponent)UnoRuntime.queryInterface( + public _XAccessibleComponent(XInterface object/*, LogWriter log*/) { + oObj = UnoRuntime.queryInterface( XAccessibleComponent.class, object); - this.log = log; + // this.log = log; } /** @@ -87,7 +87,8 @@ public class _XAccessibleComponent { * <ul> * <li> <code> getBounds() </code> : to have size of a component.</li> * </ul> - */ + * @return + */ public boolean _containsPoint() { boolean result = true ; @@ -96,13 +97,13 @@ public class _XAccessibleComponent { //while (!oObj.containsPoint(new Point(curX, bounds.Y)) && curX < bounds.Width+bounds.X) { while (!oObj.containsPoint(new Point(curX, 0)) && curX < bounds.Width) { curX++; - }; + } //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) { if (curX < bounds.Width) { - log.println("Upper bound of box contains point (" + System.out.println("Upper bound of box contains point (" + curX + ",0) - OK"); } else { - log.println + System.out.println ("Upper bound of box contains no component points - FAILED"); result = false; } @@ -112,15 +113,15 @@ public class _XAccessibleComponent { while (!oObj.containsPoint(new Point(curX, bounds.Height - 1)) && curX < bounds.Width) { - log.println("Contains returns false for ("+curX+","+bounds.Height+")"); + System.out.println("Contains returns false for ("+curX+","+bounds.Height+")"); curX++; - }; + } //if ((bounds.X <= curX) && (curX < bounds.Width+bounds.X)) { if (curX < bounds.Width) { - log.println("Lower bound of box contains point (" + System.out.println("Lower bound of box contains point (" + curX + "," + (bounds.Height - 1) + ") - OK"); } else { - log.println + System.out.println ("Lower bound of box contains no component points - FAILED"); result = false; } @@ -129,13 +130,13 @@ public class _XAccessibleComponent { //while (!oObj.containsPoint(new Point(bounds.X, curY)) && curY < bounds.Height+bounds.Y) { while (!oObj.containsPoint(new Point(0, curY)) && curY < bounds.Height) { curY++; - }; + } //if ((bounds.Y <= curY) && (curY < bounds.Height+bounds.Y)) { if (curY < bounds.Height) { - log.println("Left bound of box contains point (0," + System.out.println("Left bound of box contains point (0," + curY + ") - OK"); } else { - log.println + System.out.println ("Left bound of box contains no component points - FAILED"); result = false; } @@ -145,13 +146,13 @@ public class _XAccessibleComponent { // && curY < bounds.Height+bounds.Y) { while (!oObj.containsPoint(new Point(bounds.Width - 1, curY)) && curY < bounds.Height) { curY++; - }; + } //if ((bounds.Y <= curY) && (curY < bounds.Height + bounds.Y)) { if (curY < bounds.Height) { - log.println("Right bound of box contains point (" + System.out.println("Right bound of box contains point (" + (bounds.Width - 1) + "," + curY + ") - OK"); } else { - log.println + System.out.println ("Right bound of box contains no component points - FAILED"); result = false; } @@ -162,10 +163,10 @@ public class _XAccessibleComponent { locRes &= !oObj.containsPoint(new Point(x, bounds.Height+bounds.Y)); } if (locRes) { - log.println("Outer upper and lower bounds contain no component " + System.out.println("Outer upper and lower bounds contain no component " + "points - OK"); } else { - log.println("Outer upper and lower bounds CONTAIN some component " + System.out.println("Outer upper and lower bounds CONTAIN some component " + "points - FAILED"); result = false; } @@ -176,10 +177,10 @@ public class _XAccessibleComponent { locRes &= !oObj.containsPoint(new Point(bounds.X+bounds.Width, y)); } if (locRes) { - log.println("Outer left and right bounds contain no component " + System.out.println("Outer left and right bounds contain no component " + "points - OK"); } else { - log.println("Outer left and right bounds CONTAIN some component " + System.out.println("Outer left and right bounds CONTAIN some component " + "points - FAILED"); result = false; } @@ -198,6 +199,7 @@ public class _XAccessibleComponent { * Has <b> OK </b> status if in the first cases the right children * are returned, and in the second <code>null</code> or * another child is returned. + * @return */ public boolean _getAccessibleAtPoint() { @@ -207,23 +209,26 @@ public class _XAccessibleComponent { if (children.length > 0) { for (int i = 0; i < children.length; i++) { Rectangle chBnd = children[i].getBounds(); - if (chBnd.X == -1) continue; - log.println("Checking child with bounds " + + if (chBnd.X == -1) + { + continue; + } + System.out.println("Checking child with bounds " + "(" + chBnd.X + "," + chBnd.Y + "),(" + chBnd.Width + "," + chBnd.Height + "): " + util.AccessibilityTools.accessibleToString(children[i])); - log.println("finding the point which lies on the component"); + System.out.println("finding the point which lies on the component"); int curX = 0; int curY = 0; while (!children[i].containsPoint(new Point(curX, curY)) && curX < chBnd.Width) { curX++; curY++; - }; + } if (curX==chBnd.Width) { - log.println("Couldn't find a point with contains"); + System.out.println("Couldn't find a point with contains"); continue; } @@ -231,29 +236,29 @@ public class _XAccessibleComponent { XAccessible xAcc = oObj.getAccessibleAtPoint (new Point(chBnd.X , chBnd.Y)); if (xAcc == null) { - log.println("The child not found at point (" + System.out.println("The child not found at point (" + (chBnd.X ) + "," + chBnd.Y + ") - FAILED"); result = false; } else { - XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface + XAccessible xAccCh = UnoRuntime.queryInterface (XAccessible.class, children[i]); - log.println("Child found at point (" + System.out.println("Child found at point (" + (chBnd.X ) + "," + chBnd.Y + ") - OK"); boolean res = util.AccessibilityTools.equals(xAccCh, xAcc); if (!res) { int expIndex = xAccCh.getAccessibleContext().getAccessibleIndexInParent(); int gotIndex = xAcc.getAccessibleContext().getAccessibleIndexInParent(); if (expIndex < gotIndex) { - log.println("The children found is not the same"); - log.println("The expected child " + + System.out.println("The children found is not the same"); + System.out.println("The expected child " + xAccCh.getAccessibleContext().getAccessibleName()); - log.println("is hidden behind the found Child "); - log.println(xAcc.getAccessibleContext().getAccessibleName()+" - OK"); + System.out.println("is hidden behind the found Child "); + System.out.println(xAcc.getAccessibleContext().getAccessibleName()+" - OK"); } else { - log.println("The children found is not the same - FAILED"); - log.println("Expected: " + System.out.println("The children found is not the same - FAILED"); + System.out.println("Expected: " +xAccCh.getAccessibleContext().getAccessibleName()); - log.println("Found: " + System.out.println("Found: " +xAcc.getAccessibleContext().getAccessibleName()); result = false ; } @@ -264,22 +269,21 @@ public class _XAccessibleComponent { xAcc = oObj.getAccessibleAtPoint (new Point(chBnd.X - 1, chBnd.Y - 1)); if (xAcc == null) { - log.println("No children found at point (" + System.out.println("No children found at point (" + (chBnd.X - 1) + "," + (chBnd.Y - 1) + ") - OK"); result &= true; } else { - XAccessible xAccCh = (XAccessible) UnoRuntime.queryInterface - (XAccessible.class, children[i]); + XAccessible xAccCh = UnoRuntime.queryInterface(XAccessible.class, children[i]); boolean res = util.AccessibilityTools.equals(xAccCh, xAcc); if (res) { - log.println("The same child found outside " + System.out.println("The same child found outside " + "its bounds - FAILED"); result = false ; } } } } else { - log.println("There are no children supporting " + System.out.println("There are no children supporting " + "XAccessibleComponent"); } @@ -291,6 +295,7 @@ public class _XAccessibleComponent { * * Has <b> OK </b> status if boundary position (x,y) is not negative * and size (Width, Height) is greater than 0. + * @return */ public boolean _getBounds() { boolean result = true ; @@ -300,7 +305,7 @@ public class _XAccessibleComponent { && bounds.X >=0 && bounds.Y >=0 && bounds.Width >0 && bounds.Height >0; - log.println("Bounds = " + (bounds != null + System.out.println("Bounds = " + (bounds != null ? "(" + bounds.X + "," + bounds.Y + "),(" + bounds.Width + "," + bounds.Height + ")" : "null")); @@ -317,6 +322,7 @@ public class _XAccessibleComponent { * <ul> * <li> <code> getBounds() </code> : to have bounds </li> * </ul> + * @return */ public boolean _getLocation() { @@ -341,6 +347,7 @@ public class _XAccessibleComponent { * <li> <code> getBounds() </code> : to have location of the component * relative to its parent</li> * </ul> + * @return */ public boolean _getLocationOnScreen() { @@ -348,11 +355,11 @@ public class _XAccessibleComponent { boolean result = true ; Point loc = oObj.getLocationOnScreen(); - log.println("Location is (" + loc.X + "," + loc.Y + ")"); + System.out.println("Location is (" + loc.X + "," + loc.Y + ")"); if (parent != null) { Point parLoc = parent.getLocationOnScreen(); - log.println("Parent location is (" + System.out.println("Parent location is (" + parLoc.X + "," + parLoc.Y + ")"); result &= parLoc.X + bounds.X == loc.X; @@ -371,6 +378,7 @@ public class _XAccessibleComponent { * <ul> * <li> <code> getBounds() </code> </li> * </ul> + * @return */ public boolean _getSize() { @@ -387,6 +395,7 @@ public class _XAccessibleComponent { * Just calls the method. <p> * * Has <b> OK </b> status if no runtime exceptions occurred. + * @return */ public boolean _grabFocus() { @@ -404,26 +413,26 @@ public class _XAccessibleComponent { * such children were not found or some error occurred. */ private XAccessibleComponent[] getChildrenComponents() { - XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface - (XAccessible.class, oObj) ; + XAccessible xAcc = UnoRuntime.queryInterface(XAccessible.class, oObj) ; if (xAcc == null) { - log.println("Component doesn't support XAccessible."); + System.out.println("Component doesn't support XAccessible."); return new XAccessibleComponent[0]; } XAccessibleContext xAccCon = xAcc.getAccessibleContext(); int cnt = xAccCon.getAccessibleChildCount(); // for cases when too many children exist checking only first 50 - if (cnt > 50) cnt = 50 ; + if (cnt > 50) + { + cnt = 50; + } Vector childComp = new Vector(); for (int i = 0; i < cnt; i++) { try { XAccessible child = xAccCon.getAccessibleChild(i); XAccessibleContext xAccConCh = child.getAccessibleContext(); - XAccessibleComponent xChAccComp = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, - xAccConCh); + XAccessibleComponent xChAccComp = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConCh); if (xChAccComp != null) { childComp.add(xChAccComp) ; } @@ -442,10 +451,9 @@ public class _XAccessibleComponent { * has no parent or some errors occurred. */ private XAccessibleComponent getParentComponent() { - XAccessible xAcc = (XAccessible) UnoRuntime.queryInterface - (XAccessible.class, oObj) ; + XAccessible xAcc = UnoRuntime.queryInterface(XAccessible.class, oObj) ; if (xAcc == null) { - log.println("Component doesn't support XAccessible."); + System.out.println("Component doesn't support XAccessible."); return null; } @@ -453,14 +461,13 @@ public class _XAccessibleComponent { XAccessible xAccPar = xAccCon.getAccessibleParent(); if (xAccPar == null) { - log.println("Component has no accessible parent."); + System.out.println("Component has no accessible parent."); return null; } XAccessibleContext xAccConPar = xAccPar.getAccessibleContext(); - XAccessibleComponent parent = (XAccessibleComponent) - UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConPar); + XAccessibleComponent parent = UnoRuntime.queryInterface(XAccessibleComponent.class, xAccConPar); if (parent == null) { - log.println + System.out.println ("Accessible parent doesn't support XAccessibleComponent"); return null; } @@ -470,19 +477,21 @@ public class _XAccessibleComponent { /** * Just calls the method. + * @return */ public boolean _getForeground() { int forColor = oObj.getForeground(); - log.println("getForeground(): " + forColor); + System.out.println("getForeground(): " + forColor); return true; } /** * Just calls the method. + * @return */ public boolean _getBackground() { int backColor = oObj.getBackground(); - log.println("getBackground(): " + backColor); + System.out.println("getBackground(): " + backColor); return true; } diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java index 230eb3d098d3..14debda92cd8 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleContext.java +++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleContext.java @@ -25,7 +25,7 @@ * ************************************************************************/ -package complex.toolkit.interface_tests; +package complex.toolkit.accessibility; import com.sun.star.lang.Locale; import com.sun.star.uno.XInterface; @@ -35,9 +35,9 @@ import com.sun.star.accessibility.XAccessible; import com.sun.star.accessibility.XAccessibleContext; import com.sun.star.accessibility.XAccessibleRelationSet; import com.sun.star.accessibility.XAccessibleStateSet; -import com.sun.star.accessibility.AccessibleRelationType; +// import com.sun.star.accessibility.AccessibleRelationType; import util.AccessibilityTools; -import share.LogWriter; +// import share.LogWriter; /** * Testing <code>com.sun.star.accessibility.XAccessibleContext</code> @@ -59,7 +59,7 @@ import share.LogWriter; */ public class _XAccessibleContext { - private LogWriter log; + // private LogWriter log; private static final String className = "com.sun.star.accessibility.XAccessibleContext" ; @@ -69,19 +69,19 @@ public class _XAccessibleContext { private int childCount = 0; private XAccessible parent = null ; - public _XAccessibleContext(XInterface object, LogWriter log) { - oObj = (XAccessibleContext)UnoRuntime.queryInterface( - XAccessibleContext.class, object); - this.log = log; + public _XAccessibleContext(XInterface object) { + oObj = UnoRuntime.queryInterface(XAccessibleContext.class, object); + // this.log = log; } /** * Calls the method and stores the number of children. <p> * Has <b> OK </b> status if non-negative number rutrned. + * @return */ public boolean _getAccessibleChildCount() { childCount = oObj.getAccessibleChildCount(); - log.println("" + childCount + " children found."); + System.out.println("" + childCount + " children found."); return childCount > -1; } @@ -96,40 +96,44 @@ public class _XAccessibleContext { * <li> <code> getAccessibleChildCount() </code> : to have a number of * children </li> * </ul> + * @return */ public boolean _getAccessibleChild() { boolean bOK = true; int counter = childCount; - if (childCount > 500) counter = 500; + if (childCount > 500) + { + counter = 500; + } for (int i = 0; i < counter; i++) { try { XAccessible ch = oObj.getAccessibleChild(i) ; XAccessibleContext chAC = ch.getAccessibleContext(); - log.println(" Child " + i + ": " + + System.out.println(" Child " + i + ": " + chAC.getAccessibleDescription()) ; if (!AccessibilityTools.equals (chAC.getAccessibleParent().getAccessibleContext(), oObj)){ - log.println("Role:"); - log.println("Getting: "+chAC.getAccessibleParent().getAccessibleContext().getAccessibleRole()); - log.println("Expected: "+oObj.getAccessibleRole()); + System.out.println("Role:"); + System.out.println("Getting: "+chAC.getAccessibleParent().getAccessibleContext().getAccessibleRole()); + System.out.println("Expected: "+oObj.getAccessibleRole()); - log.println("ImplementationName:"); - log.println("Getting: "+util.utils.getImplName(chAC.getAccessibleParent().getAccessibleContext())); - log.println("Expected: "+util.utils.getImplName(oObj)); + System.out.println("ImplementationName:"); + System.out.println("Getting: "+util.utils.getImplName(chAC.getAccessibleParent().getAccessibleContext())); + System.out.println("Expected: "+util.utils.getImplName(oObj)); - log.println("The parent of child and component "+ + System.out.println("The parent of child and component "+ "itself differ."); - log.println("Getting(Description): " + System.out.println("Getting(Description): " +chAC.getAccessibleParent().getAccessibleContext().getAccessibleDescription()); - log.println("Expected(Description): " + System.out.println("Expected(Description): " +oObj.getAccessibleDescription()); bOK = false; } else { - log.println("Getting the expected Child -- OK"); + System.out.println("Getting the expected Child -- OK"); } } catch (com.sun.star.lang.IndexOutOfBoundsException e) { e.printStackTrace(); @@ -144,6 +148,7 @@ public class _XAccessibleContext { * Just gets the parent. <p> * * Has <b> OK </b> status if parent is not null. + * @return */ public boolean _getAccessibleParent() { // assume that the component is not ROOT @@ -163,6 +168,7 @@ public class _XAccessibleContext { * <ul> * <li> <code> getAccessibleParent() </code> : to have a parent </li> * </ul> + * @return */ public boolean _getAccessibleIndexInParent() { @@ -174,8 +180,8 @@ public class _XAccessibleContext { bOK &= AccessibilityTools.equals( parentAC.getAccessibleChild(idx).getAccessibleContext(),oObj); if (!bOK) { - log.println("Expected: "+util.utils.getImplName(oObj)); - log.println("Getting: "+util.utils.getImplName( + System.out.println("Expected: "+util.utils.getImplName(oObj)); + System.out.println("Getting: "+util.utils.getImplName( parentAC.getAccessibleChild(idx).getAccessibleContext())); } } catch (com.sun.star.lang.IndexOutOfBoundsException e) { @@ -189,10 +195,11 @@ public class _XAccessibleContext { * Get the accessible role of component. <p> * * Has <b> OK </b> status if non-negative number rutrned. + * @return */ public boolean _getAccessibleRole() { short role = oObj.getAccessibleRole(); - log.println("The role is " + role); + System.out.println("The role is " + role); return role > -1; } @@ -200,10 +207,11 @@ public class _XAccessibleContext { * Get the accessible name of the component. <p> * * Has <b> OK </b> status if the name has non-zero length. + * @return */ public boolean _getAccessibleName() { String name = oObj.getAccessibleName(); - log.println("The name is '" + name + "'"); + System.out.println("The name is '" + name + "'"); return name != null; } @@ -211,10 +219,11 @@ public class _XAccessibleContext { * Get the accessible description of the component. <p> * * Has <b> OK </b> status if the description has non-zero length. + * @return */ public boolean _getAccessibleDescription() { String descr = oObj.getAccessibleDescription(); - log.println("The description is '" + descr + "'"); + System.out.println("The description is '" + descr + "'"); return descr != null; } @@ -222,6 +231,7 @@ public class _XAccessibleContext { * Just gets the set. <p> * * Has <b> OK </b> status if the set is not null. + * @return */ public boolean _getAccessibleRelationSet() { XAccessibleRelationSet set = oObj.getAccessibleRelationSet(); @@ -232,6 +242,7 @@ public class _XAccessibleContext { * Just gets the set. <p> * * Has <b> OK </b> status if the set is not null. + * @return */ public boolean _getAccessibleStateSet() { XAccessibleStateSet set = oObj.getAccessibleStateSet(); @@ -244,12 +255,13 @@ public class _XAccessibleContext { * Has <b> OK </b> status if <code>Country</code> and * <code>Language</code> fields of locale structure * are not empty. + * @return */ public boolean _getLocale() { Locale loc = null ; try { loc = oObj.getLocale(); - log.println("The locale is " + loc.Language + "," + loc.Country); + System.out.println("The locale is " + loc.Language + "," + loc.Country); } catch (IllegalAccessibleComponentStateException e) { e.printStackTrace(); } diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java index 18a20d02e233..535c7ce36c68 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleEventBroadcaster.java +++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleEventBroadcaster.java @@ -25,7 +25,7 @@ * ************************************************************************/ -package complex.toolkit.interface_tests; +package complex.toolkit.accessibility; import com.sun.star.lang.EventObject; import com.sun.star.awt.Rectangle; @@ -33,13 +33,11 @@ import com.sun.star.awt.PosSize; import com.sun.star.awt.XWindow; import com.sun.star.accessibility.AccessibleEventObject; import com.sun.star.accessibility.XAccessible; -import com.sun.star.accessibility.XAccessibleComponent; import com.sun.star.accessibility.XAccessibleEventBroadcaster; import com.sun.star.accessibility.XAccessibleEventListener; import com.sun.star.accessibility.XAccessibleContext; import com.sun.star.uno.XInterface; import com.sun.star.uno.UnoRuntime; -import share.LogWriter; /** * Testing <code> @@ -62,12 +60,7 @@ import share.LogWriter; */ public class _XAccessibleEventBroadcaster { - private LogWriter log; - private static final String className = - "com.sun.star.accessibility.XAccessibleEventBroadcaster" ; - public XAccessibleEventBroadcaster oObj = null; - public String EventMsg = ""; EventProducer prod = null ; EvListener list = new EvListener(); @@ -97,7 +90,7 @@ public class _XAccessibleEventBroadcaster { private class EvListener implements XAccessibleEventListener { public AccessibleEventObject notifiedEvent = null ; public void notifyEvent(AccessibleEventObject ev) { - log.println("Listener, Event : " + ev.EventId); + System.out.println("Listener, Event : " + ev.EventId); System.out.println("EventID: " + ev.EventId); Object old=ev.OldValue; if (old instanceof com.sun.star.accessibility.XAccessible) { @@ -116,24 +109,25 @@ public class _XAccessibleEventBroadcaster { /** * c'tor + * @param object + * @param eventMessage + * @param window */ - public _XAccessibleEventBroadcaster(XInterface object, LogWriter log, String eventMessage, XWindow window) { - oObj = (XAccessibleEventBroadcaster)UnoRuntime.queryInterface( - XAccessibleEventBroadcaster.class, object); - this.log = log; + public _XAccessibleEventBroadcaster(XInterface object, XWindow window) { + oObj = UnoRuntime.queryInterface(XAccessibleEventBroadcaster.class, object); prod = new EventProducer(window); - EventMsg = eventMessage; } /** * Adds two listeners and fires event by mean of object relation. <p> * Has <b> OK </b> status if both listeners were called + * @return */ public boolean _addEventListener() { - log.println("adding two listeners"); + System.out.println("adding two listeners"); oObj.addEventListener(list); boolean isTransient = chkTransient(oObj); - log.println("fire event"); + System.out.println("fire event"); prod.fireEvent() ; try { @@ -146,15 +140,14 @@ public class _XAccessibleEventBroadcaster { if (list.notifiedEvent == null) { if (!isTransient) { - log.println("listener wasn't called"); + System.out.println("listener wasn't called"); works = false; } else { - log.println("Object is Transient, listener isn't expected to be called"); + System.out.println("Object is Transient, listener isn't expected to be called"); } oObj.removeEventListener(list); } -// log.println(EventMsg); return works; } @@ -168,15 +161,16 @@ public class _XAccessibleEventBroadcaster { * <ul> * <li> <code>addEventListener()</code> : to have added listeners </li> * </ul> + * @return */ public boolean _removeEventListener() { list.notifiedEvent = null; - log.println("remove first listener"); + System.out.println("remove first listener"); oObj.removeEventListener(list); - log.println("fire event"); + System.out.println("fire event"); prod.fireEvent() ; try { @@ -186,7 +180,7 @@ public class _XAccessibleEventBroadcaster { } if (list.notifiedEvent == null) { - log.println("listener wasn't called -- OK"); + System.out.println("listener wasn't called -- OK"); } return list.notifiedEvent == null; @@ -194,8 +188,7 @@ public class _XAccessibleEventBroadcaster { } protected static boolean chkTransient(Object Testcase) { - XAccessibleContext accCon = (XAccessibleContext) - UnoRuntime.queryInterface(XAccessibleContext.class,Testcase); + XAccessibleContext accCon = UnoRuntime.queryInterface(XAccessibleContext.class, Testcase); if (accCon.getAccessibleStateSet().contains( com.sun.star.accessibility.AccessibleStateType.TRANSIENT)){ if (!accCon.getAccessibleParent().getAccessibleContext().getAccessibleStateSet().contains( diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java index e022e60d90c0..551b00acada7 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleExtendedComponent.java +++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleExtendedComponent.java @@ -25,16 +25,16 @@ * ************************************************************************/ -package complex.toolkit.interface_tests; +package complex.toolkit.accessibility; -import lib.MultiMethodTest; +// import lib.MultiMethodTest; import com.sun.star.accessibility.XAccessibleExtendedComponent; -import com.sun.star.accessibility.XAccessibleStateSet; -import com.sun.star.accessibility.AccessibleStateType; +// import com.sun.star.accessibility.XAccessibleStateSet; +// import com.sun.star.accessibility.AccessibleStateType; import com.sun.star.awt.XFont; import com.sun.star.uno.XInterface; import com.sun.star.uno.UnoRuntime; -import share.LogWriter; +// import share.LogWriter; /** * Testing <code>com.sun.star.accessibility.XAccessibleExtendedComponent</code> @@ -51,7 +51,7 @@ import share.LogWriter; */ public class _XAccessibleExtendedComponent { - private LogWriter log; + // private LogWriter log; private static final String className = "com.sun.star.accessibility.XAccessibleExtendedComponent" ; @@ -62,38 +62,40 @@ public class _XAccessibleExtendedComponent { return className; } - public _XAccessibleExtendedComponent(XInterface object, LogWriter log) { - oObj = (XAccessibleExtendedComponent)UnoRuntime.queryInterface( - XAccessibleExtendedComponent.class, object); - this.log = log; + public _XAccessibleExtendedComponent(XInterface object/*, LogWriter log*/) { + oObj = UnoRuntime.queryInterface(XAccessibleExtendedComponent.class, object); + // this.log = log; } /** * Just calls the method. + * @return */ public boolean _getFont() { XFont font = oObj.getFont(); - log.println("getFont(): " + font); + System.out.println("getFont(): " + font); return true; } /** * Calls the method and checks returned value. * Has OK status if returned value isn't null. + * @return */ public boolean _getTitledBorderText() { String titleBorderText = oObj.getTitledBorderText(); - log.println("getTitledBorderText(): '" + titleBorderText + "'"); + System.out.println("getTitledBorderText(): '" + titleBorderText + "'"); return titleBorderText != null; } /** * Calls the method and checks returned value. * Has OK status if returned value isn't null. + * @return */ public boolean _getToolTipText() { String toolTipText = oObj.getToolTipText(); - log.println("getToolTipText(): '" + toolTipText + "'"); + System.out.println("getToolTipText(): '" + toolTipText + "'"); return toolTipText != null; } } diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java index d6357e8f24bc..a12d93a2d9e2 100755 --- a/toolkit/qa/complex/toolkit/interface_tests/_XAccessibleText.java +++ b/toolkit/qa/complex/toolkit/accessibility/_XAccessibleText.java @@ -25,10 +25,10 @@ * ************************************************************************/ -package complex.toolkit.interface_tests; +package complex.toolkit.accessibility; import com.sun.star.accessibility.XAccessibleText; -import lib.MultiMethodTest; +// import lib.MultiMethodTest; //import lib.StatusException; //import lib.Status; import com.sun.star.beans.PropertyValue; @@ -39,7 +39,7 @@ import com.sun.star.accessibility.AccessibleTextType; import com.sun.star.accessibility.TextSegment; import com.sun.star.uno.XInterface; import com.sun.star.uno.UnoRuntime; -import share.LogWriter; +// import share.LogWriter; /** * Testing <code>com.sun.star.accessibility.XAccessibleText</code> @@ -76,7 +76,7 @@ import share.LogWriter; */ public class _XAccessibleText { - private LogWriter log; + // private LogWriter log; private static final String className = "com.sun.star.accessibility.XAccessibleText" ; @@ -91,11 +91,10 @@ public class _XAccessibleText { String editOnly = null; - public _XAccessibleText(XInterface object, LogWriter log, XMultiServiceFactory xMSF, String editOnly) { - oObj = (XAccessibleText)UnoRuntime.queryInterface( - XAccessibleText.class, object); + public _XAccessibleText(XInterface object, XMultiServiceFactory xMSF, String editOnly) { + oObj = UnoRuntime.queryInterface(XAccessibleText.class, object); this.xMSF = xMSF; - this.log = log; + // this.log = log; this.editOnly = editOnly; } @@ -107,11 +106,12 @@ public class _XAccessibleText { * <ul> * <li> <code>setCaretPosition()</code> </li> * </ul> + * @return */ public boolean _getCaretPosition() { if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } @@ -123,7 +123,7 @@ public class _XAccessibleText { } int carPos = oObj.getCaretPosition(); - log.println("getCaretPosition: " + carPos); + System.out.println("getCaretPosition: " + carPos); res = carPos == (chCount - 1); } return res; @@ -138,36 +138,37 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _setCaretPosition() { boolean res = true; try { - log.println("setCaretPosition(-1):"); + System.out.println("setCaretPosition(-1):"); oObj.setCaretPosition(-1); res &= false; - log.println("exception was expected"); + System.out.println("exception was expected"); } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("expected exception"); + System.out.println("expected exception"); res &= true; } try { - log.println("setCaretPosition(chCount+1):"); + System.out.println("setCaretPosition(chCount+1):"); oObj.setCaretPosition(chCount+1); res &= false; - log.println("exception was expected"); + System.out.println("exception was expected"); } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("expected exception"); + System.out.println("expected exception"); res &= true; } if ( chCount > 0 ) { try { - log.println("setCaretPosition(chCount - 1)"); + System.out.println("setCaretPosition(chCount - 1)"); oObj.setCaretPosition(chCount - 1); res &= true; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("unexpected exception"); + System.out.println("unexpected exception"); e.printStackTrace(); res &= false; } @@ -186,46 +187,47 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getCharacter() { boolean res = true; try { - log.println("getCharacter(-1)"); + System.out.println("getCharacter(-1)"); oObj.getCharacter(-1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res = false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res = true; } try { - log.println("getCharacter(chCount)"); + System.out.println("getCharacter(chCount)"); oObj.getCharacter(chCount); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("Checking of every character in the text..."); + System.out.println("Checking of every character in the text..."); boolean isEqCh = true; for(int i = 0; i < chCount; i++) { char ch = oObj.getCharacter(i); isEqCh = ch == text.charAt(i); res &= isEqCh; if (!isEqCh) { - log.println("At the position " + i + + System.out.println("At the position " + i + "was expected character: " + text.charAt(i)); - log.println("but was returned: " + ch); + System.out.println("but was returned: " + ch); break; } } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -243,38 +245,39 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getCharacterAttributes() { boolean res = true; try { - log.println("getCharacterAttributes(-1)"); + System.out.println("getCharacterAttributes(-1)"); oObj.getCharacterAttributes(-1, new String[0]); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getCharacterAttributes(chCount)"); + System.out.println("getCharacterAttributes(chCount)"); oObj.getCharacterAttributes(chCount, new String[0]); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if ( chCount > 0 ) { - log.println("getCharacterAttributes(chCount-1)"); + System.out.println("getCharacterAttributes(chCount-1)"); PropertyValue[] props = oObj.getCharacterAttributes(chCount - 1, new String[0]); res &= props != null; } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -293,41 +296,42 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getCharacterBounds() { boolean res = true; try { - log.println("getCharacterBounds(-1)"); + System.out.println("getCharacterBounds(-1)"); oObj.getCharacterBounds(-1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getCharacterBounds(chCount)"); + System.out.println("getCharacterBounds(chCount)"); oObj.getCharacterBounds(chCount); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if (chCount > 0) { - log.println("getCharacterBounds(chCount-1)"); + System.out.println("getCharacterBounds(chCount-1)"); chBounds = oObj.getCharacterBounds(chCount-1); res &= chBounds != null; - log.println("rect: " + chBounds.X + ", " + chBounds.Y + ", " + + System.out.println("rect: " + chBounds.X + ", " + chBounds.Y + ", " + chBounds.Width + ", " + chBounds.Height); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -340,10 +344,11 @@ public class _XAccessibleText { * Calls the method and stores a returned value to the variable * <code>chCount</code>. * Has OK status if a returned value is equal to the text length. + * @return */ public boolean _getCharacterCount() { chCount = oObj.getCharacterCount(); - log.println("Character count:" + chCount); + System.out.println("Character count:" + chCount); boolean res = chCount == text.length(); return res; } @@ -358,21 +363,22 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterBounds()</code> </li> * </ul> + * @return */ public boolean _getIndexAtPoint() { boolean res = true; - log.println("getIndexAtPoint(-1, -1):"); + System.out.println("getIndexAtPoint(-1, -1):"); Point pt = new Point(-1, -1); int index = oObj.getIndexAtPoint(pt); - log.println(Integer.toString(index)); + System.out.println(Integer.toString(index)); res &= index == -1; if (chBounds != null) { pt = new Point(chBounds.X , chBounds.Y ); - log.println("getIndexAtPoint(" + pt.X + ", " + pt.Y + "):"); + System.out.println("getIndexAtPoint(" + pt.X + ", " + pt.Y + "):"); index = oObj.getIndexAtPoint(pt); - log.println(Integer.toString(index)); + System.out.println(Integer.toString(index)); res &= index == (chCount - 1); } @@ -386,40 +392,41 @@ public class _XAccessibleText { * <ul> * <li> <code>setSelection()</code> </li> * </ul> + * @return */ public boolean _getSelectedText() { if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } boolean res = true; try { - log.println("setSelection(0, 0)"); + System.out.println("setSelection(0, 0)"); oObj.setSelection(0, 0); - log.println("getSelectedText():"); + System.out.println("getSelectedText():"); String txt = oObj.getSelectedText(); - log.println("'" + txt + "'"); + System.out.println("'" + txt + "'"); res &= txt.length() == 0; - log.println("setSelection(0, chCount)"); + System.out.println("setSelection(0, chCount)"); oObj.setSelection(0, chCount); - log.println("getSelectedText():"); + System.out.println("getSelectedText():"); txt = oObj.getSelectedText(); - log.println("'" + txt + "'"); + System.out.println("'" + txt + "'"); res &= txt.equals(text); if (chCount > 2) { - log.println("setSelection(1, chCount-1)"); + System.out.println("setSelection(1, chCount-1)"); oObj.setSelection(1, chCount - 1); - log.println("getSelectedText():"); + System.out.println("getSelectedText():"); txt = oObj.getSelectedText(); - log.println("'" + txt + "'"); + System.out.println("'" + txt + "'"); res &= txt.equals(text.substring(1, chCount - 1)); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -434,31 +441,32 @@ public class _XAccessibleText { * <ul> * <li> <code>setSelection()</code> </li> * </ul> + * @return */ public boolean _getSelectionStart() { if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } boolean res = true; try { - log.println("setSelection(0, chCount)"); + System.out.println("setSelection(0, chCount)"); oObj.setSelection(0, chCount); int start = oObj.getSelectionStart(); - log.println("getSelectionStart():" + start); + System.out.println("getSelectionStart():" + start); res &= start == 0; if (chCount > 2) { - log.println("setSelection(1, chCount-1)"); + System.out.println("setSelection(1, chCount-1)"); oObj.setSelection(1, chCount - 1); start = oObj.getSelectionStart(); - log.println("getSelectionStart():" + start); + System.out.println("getSelectionStart():" + start); res &= start == 1; } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -473,31 +481,32 @@ public class _XAccessibleText { * <ul> * <li> <code>setSelection()</code> </li> * </ul> + * @return */ public boolean _getSelectionEnd() { if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } boolean res = true; try { - log.println("setSelection(0, chCount)"); + System.out.println("setSelection(0, chCount)"); oObj.setSelection(0, chCount); int end = oObj.getSelectionEnd(); - log.println("getSelectionEnd():" + end); + System.out.println("getSelectionEnd():" + end); res &= end == chCount; if (chCount > 2) { - log.println("setSelection(1, chCount-1)"); + System.out.println("setSelection(1, chCount-1)"); oObj.setSelection(1, chCount - 1); end = oObj.getSelectionEnd(); - log.println("getSelectionEnd():" + end); + System.out.println("getSelectionEnd():" + end); res &= end == chCount - 1; } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -513,67 +522,68 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _setSelection() { boolean res = true; boolean locRes = true; if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } try { - log.println("setSelection(-1, chCount-1):"); + System.out.println("setSelection(-1, chCount-1):"); locRes = oObj.setSelection(-1, chCount - 1); - log.println(locRes + " exception was expected"); + System.out.println(locRes + " exception was expected"); res &= !locRes; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("setSelection(0, chCount+1):"); + System.out.println("setSelection(0, chCount+1):"); locRes = oObj.setSelection(0, chCount + 1); - log.println(locRes + " excepion was expected"); + System.out.println(locRes + " excepion was expected"); res &= !locRes; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if (chCount > 2) { - log.println("setSelection(1, chCount-1):"); + System.out.println("setSelection(1, chCount-1):"); locRes = oObj.setSelection(1, chCount - 1); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; - log.println("setSelection(chCount-1, 1):"); + System.out.println("setSelection(chCount-1, 1):"); locRes = oObj.setSelection(chCount - 1, 1); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; } if (chCount > 1) { - log.println("setSelection(0, chCount-1):"); + System.out.println("setSelection(0, chCount-1):"); locRes = oObj.setSelection(0, chCount-1); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; - log.println("setSelection(chCount-1, 0):"); + System.out.println("setSelection(chCount-1, 0):"); locRes = oObj.setSelection(chCount-1, 0); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; } - log.println("setSelection(0, 0):"); + System.out.println("setSelection(0, 0):"); locRes = oObj.setSelection(0, 0); - log.println(Boolean.toString(locRes)); + System.out.println(Boolean.toString(locRes)); res &= locRes; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } @@ -585,10 +595,11 @@ public class _XAccessibleText { * Calls the method and checks returned value. * Has OK status if returned string is not null * received from relation. + * @return */ public boolean _getText() { text = oObj.getText(); - log.println("getText: '" + text + "'"); + System.out.println("getText: '" + text + "'"); return (text != null); } @@ -602,6 +613,7 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getTextRange() { boolean res = true; @@ -609,75 +621,75 @@ public class _XAccessibleText { try { if (chCount > 3) { - log.println("getTextRange(1, chCount - 2): "); + System.out.println("getTextRange(1, chCount - 2): "); String txtRange = oObj.getTextRange(1, chCount - 2); - log.println(txtRange); + System.out.println(txtRange); locRes = txtRange.equals(text.substring(1, chCount - 2)); res &= locRes; if (!locRes) { - log.println("Was expected: " + + System.out.println("Was expected: " + text.substring(1, chCount - 2)); } } if (chCount > 0) { - log.println("getTextRange(0, chCount-1): "); + System.out.println("getTextRange(0, chCount-1): "); String txtRange = oObj.getTextRange(0, chCount-1); - log.println(txtRange); + System.out.println(txtRange); locRes = txtRange.equals(text.substring(0, chCount - 1)); res &= locRes; if (!locRes) { - log.println("Was expected: " + + System.out.println("Was expected: " + text.substring(0, chCount - 1)); } - log.println("getTextRange(chCount, 0): "); + System.out.println("getTextRange(chCount, 0): "); txtRange = oObj.getTextRange(chCount, 0); - log.println(txtRange); + System.out.println(txtRange); res &= txtRange.equals(text); - log.println("getTextRange(0, 0): "); + System.out.println("getTextRange(0, 0): "); txtRange = oObj.getTextRange(0, 0); - log.println(txtRange); + System.out.println(txtRange); locRes = txtRange.equals(""); res &= locRes; if (!locRes) { - log.println("Empty string was expected"); + System.out.println("Empty string was expected"); } } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } try { - log.println("getTextRange(-1, chCount - 1): "); + System.out.println("getTextRange(-1, chCount - 1): "); String txtRange = oObj.getTextRange(-1, chCount - 1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextRange(0, chCount + 1): "); + System.out.println("getTextRange(0, chCount + 1): "); String txtRange = oObj.getTextRange(0, chCount + 1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextRange(chCount+1, -1): "); + System.out.println("getTextRange(chCount+1, -1): "); String txtRange = oObj.getTextRange(chCount+1, -1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } @@ -694,62 +706,63 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getTextAtIndex() { boolean res = true; try { - log.println("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):"); + System.out.println("getTextAtIndex(-1, AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextAtIndex(-1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextAtIndex(chCount+1," + + System.out.println("getTextAtIndex(chCount+1," + " AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextAtIndex(chCount + 1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if ( chCount > 0 ) { - log.println("getTextAtIndex(chCount," + + System.out.println("getTextAtIndex(chCount," + " AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextAtIndex(chCount, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == 0; - log.println("getTextAtIndex(1," + + System.out.println("getTextAtIndex(1," + " AccessibleTextType.PARAGRAPH):"); txt = oObj.getTextAtIndex(1, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); res &= false; } @@ -767,78 +780,79 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getTextBeforeIndex() { boolean res = true; try { - log.println("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):"); + System.out.println("getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBeforeIndex(-1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextBeforeIndex(chCount+1, " + + System.out.println("getTextBeforeIndex(chCount+1, " + "AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBeforeIndex(chCount + 1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } TextSegment txt = null; try { if (chCount > 0) { - log.println("getTextBeforeIndex(chCount," + + System.out.println("getTextBeforeIndex(chCount," + " AccessibleTextType.PARAGRAPH):"); txt = oObj.getTextBeforeIndex(chCount, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == chCount ; - log.println("getTextBeforeIndex(1," + + System.out.println("getTextBeforeIndex(1," + " AccessibleTextType.PARAGRAPH):"); txt = oObj.getTextBeforeIndex(1, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == 0; } if (chCount > 2) { - log.println("getTextBeforeIndex(chCount-1," + + System.out.println("getTextBeforeIndex(chCount-1," + " AccessibleTextType.CHARACTER):"); txt = oObj.getTextBeforeIndex(chCount - 1, AccessibleTextType.CHARACTER); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text.substring(chCount - 2, chCount - 1)); - log.println("getTextBeforeIndex(2," + + System.out.println("getTextBeforeIndex(2," + " AccessibleTextType.CHARACTER):"); txt = oObj.getTextBeforeIndex(2, AccessibleTextType.CHARACTER); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text.substring(1, 2)); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); res &= false; } @@ -856,79 +870,80 @@ public class _XAccessibleText { * <ul> * <li> <code>getCharacterCount()</code> </li> * </ul> + * @return */ public boolean _getTextBehindIndex() { boolean res = true; try { - log.println("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):"); + System.out.println("getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBehindIndex(-1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("getTextBehindIndex(chCount+1, " + + System.out.println("getTextBehindIndex(chCount+1, " + "AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBehindIndex(chCount + 1, AccessibleTextType.PARAGRAPH); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { if ( chCount > 0 ) { - log.println("getTextBehindIndex(chCount," + + System.out.println("getTextBehindIndex(chCount," + " AccessibleTextType.PARAGRAPH):"); TextSegment txt = oObj.getTextBehindIndex(chCount, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == 0; - log.println("getTextBehindIndex(chCount-1," + + System.out.println("getTextBehindIndex(chCount-1," + " AccessibleTextType.PARAGRAPH):"); txt = oObj.getTextBehindIndex(chCount - 1, AccessibleTextType.PARAGRAPH); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.length() == 0; } if ( chCount > 1 ) { - log.println("getTextBehindIndex(1," + + System.out.println("getTextBehindIndex(1," + " AccessibleTextType.CHARACTER):"); TextSegment txt = oObj.getTextBehindIndex(1, AccessibleTextType.CHARACTER); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text.substring(2, 3)); } if (chCount > 2) { - log.println("getTextBehindIndex(chCount-2," + + System.out.println("getTextBehindIndex(chCount-2," + " AccessibleTextType.CHARACTER):"); TextSegment txt = oObj.getTextBehindIndex(chCount - 2, AccessibleTextType.CHARACTER); - log.println("'" + txt.SegmentText + "'"); + System.out.println("'" + txt.SegmentText + "'"); res &= txt.SegmentText.equals(text.substring(chCount - 1, chCount)); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } catch(com.sun.star.lang.IllegalArgumentException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); res &= false; } @@ -942,40 +957,41 @@ public class _XAccessibleText { * Has OK status if exception was thrown for invalid parameters, * if exception wasn't thrown for valid parameter and if returned value for * valid parameter is equal to <code>true</code>. + * @return */ public boolean _copyText() { boolean res = true; boolean locRes = true; if (editOnly != null) { - log.println(editOnly); + System.out.println(editOnly); return true; } try { - log.println("copyText(-1,chCount):"); + System.out.println("copyText(-1,chCount):"); oObj.copyText(-1, chCount); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("copyText(0,chCount+1):"); + System.out.println("copyText(0,chCount+1):"); oObj.copyText(0, chCount + 1); - log.println("Exception was expected"); + System.out.println("Exception was expected"); res &= false; } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Expected exception"); + System.out.println("Expected exception"); res &= true; } try { - log.println("copyText(0,chCount):"); + System.out.println("copyText(0,chCount):"); locRes = oObj.copyText(0, chCount); - log.println(""+locRes); + System.out.println(""+locRes); res &= locRes; String cbText = null; @@ -983,31 +999,31 @@ public class _XAccessibleText { cbText = util.SysUtils.getSysClipboardText(xMSF); } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't access system clipboard :"); + System.out.println("Couldn't access system clipboard :"); e.printStackTrace(); } - log.println("Clipboard: '" + cbText + "'"); + System.out.println("Clipboard: '" + cbText + "'"); res &= text.equals(cbText); if (chCount > 2) { - log.println("copyText(1,chCount-1):"); + System.out.println("copyText(1,chCount-1):"); locRes = oObj.copyText(1, chCount - 1); - log.println(""+locRes); + System.out.println(""+locRes); res &= locRes; try { cbText = util.SysUtils.getSysClipboardText(xMSF); } catch (com.sun.star.uno.Exception e) { - log.println("Couldn't access system clipboard :"); + System.out.println("Couldn't access system clipboard :"); e.printStackTrace(); } - log.println("Clipboard: '" + cbText + "'"); + System.out.println("Clipboard: '" + cbText + "'"); res &= text.substring(1, chCount - 1).equals(cbText); } } catch(com.sun.star.lang.IndexOutOfBoundsException e) { - log.println("Unexpected exception"); + System.out.println("Unexpected exception"); e.printStackTrace(); res &= false; } diff --git a/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java b/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java new file mode 100755 index 000000000000..11e4a4b19f80 --- /dev/null +++ b/toolkit/qa/complex/toolkit/awtgrid/DummyColumn.java @@ -0,0 +1,180 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + *************************************************************************/ + +package complex.toolkit.awtgrid; + +import com.sun.star.awt.grid.XGridColumn; +import com.sun.star.awt.grid.XGridColumnListener; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.XEventListener; +import com.sun.star.style.HorizontalAlignment; +import com.sun.star.util.XCloneable; + +/** + * a dummy implementation of css.awt.grid.XGridColumn + * @author frank.schoenheit@oracle.com + */ +public class DummyColumn implements XGridColumn +{ + public DummyColumn() + { + } + + public Object getIdentifier() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setIdentifier( Object o ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public int getColumnWidth() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setColumnWidth( int i ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public int getMinWidth() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setMinWidth( int i ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public int getMaxWidth() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setMaxWidth( int i ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public boolean getResizeable() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setResizeable( boolean bln ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public int getFlexibility() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setFlexibility( int i ) throws IllegalArgumentException + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public HorizontalAlignment getHorizontalAlign() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setHorizontalAlign( HorizontalAlignment ha ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public String getTitle() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setTitle( String string ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public String getHelpText() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setHelpText( String string ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public int getIndex() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public int getDataColumnIndex() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void setDataColumnIndex( int i ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void addGridColumnListener( XGridColumnListener xl ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void removeGridColumnListener( XGridColumnListener xl ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void dispose() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void addEventListener( XEventListener xl ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public void removeEventListener( XEventListener xl ) + { + throw new UnsupportedOperationException( "Not supported yet." ); + } + + public XCloneable createClone() + { + throw new UnsupportedOperationException( "Not supported yet." ); + } +} diff --git a/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java b/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java new file mode 100755 index 000000000000..c31f27796cf1 --- /dev/null +++ b/toolkit/qa/complex/toolkit/awtgrid/GridDataListener.java @@ -0,0 +1,98 @@ +package complex.toolkit.awtgrid; + +import com.sun.star.awt.grid.GridDataEvent; +import com.sun.star.awt.grid.XGridDataListener; +import com.sun.star.lang.EventObject; +import static org.junit.Assert.*; + +final public class GridDataListener implements XGridDataListener +{ + public GridDataListener() + { + } + + public void rowsInserted( GridDataEvent i_event ) + { + assertNull( m_rowInsertionEvent ); + m_rowInsertionEvent = i_event; + } + + public void rowsRemoved( GridDataEvent i_event ) + { + assertNull( m_rowRemovalEvent ); + m_rowRemovalEvent = i_event; + } + + public void dataChanged( GridDataEvent i_event ) + { + assertNull( m_dataChangeEvent ); + m_dataChangeEvent = i_event; + } + + public void rowHeadingChanged( GridDataEvent i_event ) + { + assertNull( m_rowHeadingChangeEvent ); + m_rowHeadingChangeEvent = i_event; + } + + public void disposing( EventObject eo ) + { + m_disposed = true; + } + + public final GridDataEvent assertSingleRowInsertionEvent() + { + assertNotNull( m_rowInsertionEvent ); + assertNull( m_rowRemovalEvent ); + assertNull( m_dataChangeEvent ); + assertNull( m_rowHeadingChangeEvent ); + assertFalse( m_disposed ); + return m_rowInsertionEvent; + } + + public final GridDataEvent assertSingleRowRemovalEvent() + { + assertNull( m_rowInsertionEvent ); + assertNotNull( m_rowRemovalEvent ); + assertNull( m_dataChangeEvent ); + assertNull( m_rowHeadingChangeEvent ); + assertFalse( m_disposed ); + return m_rowRemovalEvent; + } + + public final GridDataEvent assertSingleDataChangeEvent() + { + assertNull( m_rowInsertionEvent ); + assertNull( m_rowRemovalEvent ); + assertNotNull( m_dataChangeEvent ); + assertNull( m_rowHeadingChangeEvent ); + assertFalse( m_disposed ); + return m_dataChangeEvent; + } + + public final GridDataEvent assertSingleRowHeadingChangeEvent() + { + assertNull( m_rowInsertionEvent ); + assertNull( m_rowRemovalEvent ); + assertNull( m_dataChangeEvent ); + assertNotNull( m_rowHeadingChangeEvent ); + assertFalse( m_disposed ); + return m_rowHeadingChangeEvent; + } + + public final boolean isDisposed() + { + return m_disposed; + } + + public final void reset() + { + m_rowInsertionEvent = m_rowRemovalEvent = m_dataChangeEvent = m_rowHeadingChangeEvent = null; + // m_disposed is not reset intentionally + } + private GridDataEvent m_rowInsertionEvent = null; + private GridDataEvent m_rowRemovalEvent = null; + private GridDataEvent m_dataChangeEvent = null; + private GridDataEvent m_rowHeadingChangeEvent = null; + private boolean m_disposed = false; +} diff --git a/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java b/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java new file mode 100755 index 000000000000..c550dd9a047d --- /dev/null +++ b/toolkit/qa/complex/toolkit/awtgrid/TMutableGridDataModel.java @@ -0,0 +1,314 @@ +/************************************************************************* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + *************************************************************************/ + +package complex.toolkit.awtgrid; + +import java.lang.reflect.Method; +import com.sun.star.awt.grid.GridDataEvent; +import com.sun.star.awt.grid.XMutableGridDataModel; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.IndexOutOfBoundsException; +import static org.junit.Assert.*; +import static complex.toolkit.Assert.*; + +/** test for the <code>css.awt.grid.XMutableGridData</code> interface + * + * @author frank.schoenheit@oracle.com + */ +public class TMutableGridDataModel +{ + public TMutableGridDataModel( final XMutableGridDataModel i_dataModel ) + { + m_dataModel = i_dataModel; + + m_listener = new GridDataListener(); + m_dataModel.addGridDataListener( m_listener ); + } + + /* + * tests the XMutableGridDataModel.addRow method + */ + public void testAddRow() throws IndexOutOfBoundsException + { + m_dataModel.addRow( 1, m_rowValues[0] ); + GridDataEvent event = m_listener.assertSingleRowInsertionEvent(); + m_listener.reset(); + assertEquals( "row insertion: wrong FirstRow (1)", 0, event.FirstRow ); + assertEquals( "row insertion: wrong LastRow (1)", 0, event.LastRow ); + impl_assertRowData( 0 ); + + m_dataModel.addRow( 2, m_rowValues[1] ); + event = m_listener.assertSingleRowInsertionEvent(); + m_listener.reset(); + assertEquals( "row insertion: wrong FirstRow (2)", 1, event.FirstRow ); + assertEquals( "row insertion: wrong LastRow (2)", 1, event.LastRow ); + impl_assertRowData( 1 ); + } + + /** + * tests the XMutableGridDataModel.addRows method + */ + public void testAddRows() throws IndexOutOfBoundsException, IllegalArgumentException + { + assertEquals( "precondition not met: call this directly after testAddRow, please!", 2, m_dataModel.getRowCount() ); + + m_dataModel.addRows( new Object[] { "3", 4.0, "5" }, new Object[][] { m_rowValues[2], m_rowValues[3], m_rowValues[4] } ); + GridDataEvent event = m_listener.assertSingleRowInsertionEvent(); + assertEquals( "row insertion: wrong FirstRow (1)", 2, event.FirstRow ); + assertEquals( "row insertion: wrong LastRow (1)", 4, event.LastRow ); + m_listener.reset(); + + assertEquals( "data model's row count is not adjusted when adding rows", m_rowValues.length, m_dataModel.getRowCount() ); + assertEquals( "data model's column count is not adjusted when adding rows", m_rowValues[0].length, m_dataModel.getColumnCount() ); + for ( int row=0; row<m_rowValues.length; ++row ) + { + for ( int col=0; col<m_rowValues[row].length; ++col ) + { + assertEquals( "added row values are not preserved", + m_rowValues[row][col], m_dataModel.getCellData( col, row ) ); + } + } + + assertException( "addRows is expected to throw when invoked with different-sized arrays", + m_dataModel, "addRows", new Object[] { new Object[0], new Object[1][2] }, IllegalArgumentException.class ); + } + + /** + * tests the XMutableGridDataModel.removeRow method + */ + public void testRemoveRow() throws IndexOutOfBoundsException + { + assertEquals( "precondition not met: call this directly after testAddRows, please!", m_rowValues.length, m_dataModel.getRowCount() ); + + final int rowToRemove = 2; + m_dataModel.removeRow( rowToRemove ); + GridDataEvent event = m_listener.assertSingleRowRemovalEvent(); + assertEquals( "incorrect notification of row removal (FirstRow)", rowToRemove, event.FirstRow ); + assertEquals( "incorrect notification of row removal (LastRow)", rowToRemove, event.LastRow ); + m_listener.reset(); + + assertEquals( "data model's row count does not reflect the removed row", m_rowValues.length - 1, m_dataModel.getRowCount() ); + for ( int row = rowToRemove; row<m_rowValues.length-1; ++row ) + { + for ( int col=0; col<m_rowValues[row].length; ++col ) + { + assertEquals( "unexpected row values after removing a row (col: " + col + ", row: " + row + ")", + m_rowValues[row+1][col], m_dataModel.getCellData( col, row ) ); + } + } + + assertException( "removeRow silently ignores an invalid index (1)", + m_dataModel, "removeRow", new Object[] { -1 }, IndexOutOfBoundsException.class ); + assertException( "removeRow silently ignores an invalid index (2)", + m_dataModel, "removeRow", new Object[] { m_dataModel.getRowCount() }, IndexOutOfBoundsException.class ); + } + + /** + * tests the XMutableGridDataModel.removeAllRows method + */ + public void testRemoveAllRows() + { + assertEquals( "precondition not met: call this directly after testRemoveRow, please!", m_rowValues.length - 1, m_dataModel.getRowCount() ); + + m_dataModel.removeAllRows(); + final GridDataEvent event = m_listener.assertSingleRowRemovalEvent(); + if ( event.FirstRow != -1 ) + { // notifying "-1" is allowed, this means "all rows affected", by definition + assertEquals( "removeAllRows is not notifying properly (1)", 0, event.FirstRow ); + assertEquals( "removeAllRows is not notifying properly (2)", m_rowValues.length - 1, event.LastRow ); + } + m_listener.reset(); + } + + /** + * tests the XMutableGridDataModel.updateCellData method + */ + public void testUpdateCellData() throws IndexOutOfBoundsException, IllegalArgumentException + { + assertEquals( "precondition not met: call this directly after testRemoveAllRows, please!", 0, m_dataModel.getRowCount() ); + + m_dataModel.addRows( new Object[] { 1, 2, 3, 4, 5 }, m_rowValues ); + m_listener.assertSingleRowInsertionEvent(); + m_listener.reset(); + + final Object[][] modifyValues = new Object[][] { + new Object[] { 2, 1, "text" }, + new Object[] { 3, 0, null }, + new Object[] { 0, 4, new Double( 33.0 ) } + }; + for ( int i = 0; i < modifyValues.length; ++i ) + { + final int row = ((Integer)modifyValues[i][0]).intValue(); + final int col = ((Integer)modifyValues[i][1]).intValue(); + final Object value = modifyValues[i][2]; + m_dataModel.updateCellData( col, row, value ); + + final GridDataEvent event = m_listener.assertSingleDataChangeEvent(); + assertEquals( "data change notification: FirstRow is invalid", row, event.FirstRow ); + assertEquals( "data change notification: LastRow is invalid", row, event.LastRow ); + assertEquals( "data change notification: FirstColumn is invalid", col, event.FirstColumn ); + assertEquals( "data change notification: LastColumn is invalid", col, event.LastColumn ); + m_listener.reset(); + + assertEquals( "data change at (" + col + ", " + row + ") not successful", value, m_dataModel.getCellData( col, row ) ); + } + + assertException( "updateCellData silently ignores an invalid index (1)", + m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class }, + new Object[] { -1, -1, "text" }, IndexOutOfBoundsException.class ); + assertException( "updateCellData silently ignores an invalid index (2)", + m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class }, + new Object[] { 0, m_dataModel.getRowCount(), "text" }, IndexOutOfBoundsException.class ); + assertException( "updateCellData silently ignores an invalid index (3)", + m_dataModel, "updateCellData", new Class[] { int.class, int.class, Object.class }, + new Object[] { m_dataModel.getColumnCount(), 0, "text" }, IndexOutOfBoundsException.class ); + } + + /** + * tests the XMutableGridDataModel.updateRowData method + */ + public void testUpdateRowData() throws IndexOutOfBoundsException, IllegalArgumentException + { + assertEquals( "precondition not met: call this directly after testRemoveAllRows, please!", m_rowValues.length, m_dataModel.getRowCount() ); + + // get data from before the update + final Object[][] preUpdateValues = impl_getCurrentData(); + + // do the update + final int[] colIndexes = new int[] { + 0, 3, 4 + }; + final Object[] values = new Object[] { + 13, null, 42.0 + }; + final int rowToUpdate = 2; + m_dataModel.updateRowData( colIndexes, rowToUpdate, values ); + final GridDataEvent event = m_listener.assertSingleDataChangeEvent(); + assertEquals( "row update notification: FirstRow is invalid", rowToUpdate, event.FirstRow ); + assertEquals( "row update notification: LastRow is invalid", rowToUpdate, event.LastRow ); + assertEquals( "row update notification: FirstColumn is invalid", 0, event.FirstColumn ); + assertEquals( "row update notification: LastColumn is invalid", 4, event.LastColumn ); + m_listener.reset(); + + // reflect the changes made in the pre-update data + for ( int i=0; i<colIndexes.length; ++i ) + { + preUpdateValues[rowToUpdate][colIndexes[i]] = values[i]; + } + + // get data from after the update + final Object[][] postUpdateValues = impl_getCurrentData(); + + // ensure both the manually updated pre-update data and the post-update data are identical + assertArrayEquals( preUpdateValues, postUpdateValues ); + + + assertException( "updateRowData silently ignores an invalid index (1)", + m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class }, + new Object[] { new int[] { -1 }, 0, new Object[] { "text" } }, IndexOutOfBoundsException.class ); + assertException( "updateRowData silently ignores an invalid index (2)", + m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class }, + new Object[] { new int[] { 0 }, -1, new Object[] { "" } }, IndexOutOfBoundsException.class ); + assertException( "updateRowData silently ignores different-sized arrays", + m_dataModel, "updateRowData", new Class[] { int[].class, int.class, Object[].class }, + new Object[] { new int[] { 0, 0 }, 0, new Object[] { "" } }, IllegalArgumentException.class ); + } + + /** + * tests the XMutableGridDataModel.updateRowHeading method + */ + public void testUpdateRowHeading() throws IndexOutOfBoundsException + { + assertEquals( "precondition not met: call this directly after testUpdateRowData, please!", m_rowValues.length, m_dataModel.getRowCount() ); + + final Object[] preUpdateHeadings = impl_getCurrentRowHeadings(); + + final int rowToUpdate = 2; + final String valueToUpdate = "some text"; + m_dataModel.updateRowHeading( rowToUpdate, valueToUpdate ); + final GridDataEvent event = m_listener.assertSingleRowHeadingChangeEvent(); + assertEquals( "row heading update notification: FirstRow is invalid", rowToUpdate, event.FirstRow ); + assertEquals( "row heading update notification: FirstRow is invalid", rowToUpdate, event.LastRow ); + m_listener.reset(); + + preUpdateHeadings[rowToUpdate] = valueToUpdate; + + final Object[] postUpdateHeadings = impl_getCurrentRowHeadings(); + assertArrayEquals( preUpdateHeadings, postUpdateHeadings ); + + assertException( "updateRowHeading silently ignores an invalid index", + m_dataModel, "updateRowHeading", new Class[] { int.class, Object.class }, + new Object[] { -1, "" }, IndexOutOfBoundsException.class ); + } + + public void cleanup() + { + m_dataModel.removeGridDataListener( m_listener ); + } + + private Object[][] impl_getCurrentData() throws IndexOutOfBoundsException + { + final int rowCount = m_dataModel.getRowCount(); + final int colCount = m_dataModel.getColumnCount(); + final Object[][] data = new Object[rowCount][colCount]; + for ( int row=0; row<rowCount; ++row ) + { + for ( int col=0; col<colCount; ++col ) + { + data[row][col] = m_dataModel.getCellData( col, row ); + } + } + return data; + } + + private Object[] impl_getCurrentRowHeadings() throws IndexOutOfBoundsException + { + final int rowCount = m_dataModel.getRowCount(); + final Object[] headings = new Object[rowCount]; + for ( int row=0; row<rowCount; ++row ) + headings[row] = m_dataModel.getRowHeading( row ); + return headings; + } + + private void impl_assertRowData( final int i_rowIndex ) throws IndexOutOfBoundsException + { + for ( int i=0; i<m_rowValues[i_rowIndex].length; ++i ) + { + assertEquals( m_rowValues[i_rowIndex][i], m_dataModel.getCellData( i, i_rowIndex ) ); + } + } + + private final XMutableGridDataModel m_dataModel; + private final GridDataListener m_listener; + + private final static Object[][] m_rowValues = new Object[][] { + new Object[] { 1, 2, "3", 4, 5 }, + new Object[] { 2, 3, 4, "5", 6 }, + new Object[] { "3", 4, 5, 6, 7 }, + new Object[] { 4, 5, 6, 7, "8" }, + new Object[] { 5, "6", 7, 8, 9 }, + }; +} diff --git a/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java b/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java deleted file mode 100644 index 472412e80aa6..000000000000 --- a/toolkit/qa/complex/toolkit/interface_tests/_XRequestCallback.java +++ /dev/null @@ -1,88 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.toolkit.interface_tests; - -import com.sun.star.awt.XRequestCallback; -import lib.MultiMethodTest; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.uno.XInterface; -import com.sun.star.uno.UnoRuntime; -import share.LogWriter; - -/** - * Testing <code>com.sun.star.awt.XRequestCallback</code> - * interface methods : - * <ul> - * <li><code> addCallback()</code></li> - * </ul> <p> - * @see com.sun.star.awt.XRequestCallback - */ -public class _XRequestCallback { - - private LogWriter log; - - private static final String className = - "com.sun.star.awt.XRequestCallback" ; - - public XRequestCallback oObj = null; - private XMultiServiceFactory xMSF; - - String text = null; - - - public _XRequestCallback(XInterface object, LogWriter log, XMultiServiceFactory xMSF ) { - oObj = (XRequestCallback)UnoRuntime.queryInterface( - XRequestCallback.class, object); - this.xMSF = xMSF; - this.log = log; - } - - - /** - * Calls the method and checks returned value. - * Has OK status if returned value is equal to <code>chCount - 1</code>. - * The following method tests are to be executed before: - * <ul> - * <li> <code>addCallback()</code> </li> - * </ul> - */ - public boolean _addCallback() { - - boolean res = true; - try { - Object a = new Object(); - oObj.addCallback( null, a ); - } catch (com.sun.star.uno.RuntimeException ie) { - res = false; - } - log.println("addCallback called" ); - - return res; - } - -} diff --git a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk b/toolkit/qa/complex/toolkit/interface_tests/makefile.mk deleted file mode 100755 index 0e324109f28d..000000000000 --- a/toolkit/qa/complex/toolkit/interface_tests/makefile.mk +++ /dev/null @@ -1,57 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = ..$/..$/..$/.. -TARGET = Toolkit -PRJNAME = $(TARGET) -PACKAGE = complex$/toolkit$/interface_tests - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = _XAccessibleComponent.java \ - _XAccessibleContext.java \ - _XAccessibleExtendedComponent.java \ - _XAccessibleEventBroadcaster.java \ - _XAccessibleText.java \ - _XRequestCallback.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) - -# --- Targets ------------------------------------------------------ - -.IF "$(depend)" == "" -ALL : ALLTAR -.ELSE -ALL: ALLDEP -.ENDIF - -.INCLUDE : target.mk - diff --git a/toolkit/qa/complex/toolkit/makefile.mk b/toolkit/qa/complex/toolkit/makefile.mk index 3a4e096719bb..ecb173f9bdac 100755 --- a/toolkit/qa/complex/toolkit/makefile.mk +++ b/toolkit/qa/complex/toolkit/makefile.mk @@ -25,58 +25,73 @@ # #************************************************************************* -PRJ = ..$/..$/.. -TARGET = Toolkit -PRJNAME = $(TARGET) -PACKAGE = complex$/toolkit +.IF "$(OOO_JUNIT_JAR)" == "" +nothing .PHONY: + @echo ----------------------------------------------------- + @echo - JUnit not available, not building anything + @echo ----------------------------------------------------- +.ELSE # IF "$(OOO_JUNIT_JAR)" != "" + +PRJ = ../../.. +PRJNAME = toolkit +TARGET = qa_complex_toolkit +PACKAGE = complex/toolkit # --- Settings ----------------------------------------------------- .INCLUDE: settings.mk - #----- compile .java files ----------------------------------------- -JARFILES = mysql.jar ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = CheckAccessibleStatusBar.java CheckAccessibleStatusBarItem.java CheckAsyncCallback.java CallbackClass.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -SUBDIRS = interface_tests +JARFILES = OOoRunnerLight.jar ridl.jar test.jar unoil.jar +EXTRAJARFILES = $(OOO_JUNIT_JAR) -#----- make a jar from compiled files ------------------------------ +JAVAFILES = \ + $(JAVATESTFILES) \ + accessibility/_XAccessibleComponent.java \ + accessibility/_XAccessibleContext.java \ + accessibility/_XAccessibleEventBroadcaster.java \ + accessibility/_XAccessibleExtendedComponent.java \ + accessibility/_XAccessibleText.java \ + Assert.java \ + awtgrid/GridDataListener.java \ + awtgrid/TMutableGridDataModel.java \ + awtgrid/DummyColumn.java \ -MAXLINELENGTH = 100000 +#----- create a jar from compiled files ---------------------------- -JARCLASSDIRS = $(PACKAGE) JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE -# --- Parameters for the test -------------------------------------- +#----- JUnit tests class ------------------------------------------- -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF +JAVATESTFILES = \ + GridControl.java \ + UnitConversion.java \ -# test base is java complex -CT_TESTBASE = -tb java_complex -# build up package name with "." instead of $/ -CT_PACKAGE = -o $(PACKAGE:s\$/\.\) +# disabled for now - the tests fail on at least one platform +# no issue, yet (not sure this is worth it. Don't know who to give the issue to, and don't know whether the test really makes sense) +DISABLED_JAVA_TEST_FILES=\ + AccessibleStatusBar.java\ + AccessibleStatusBarItem.java -# start the runner application -CT_APP = org.openoffice.Runner # --- Targets ------------------------------------------------------ -.INCLUDE : target.mk +.INCLUDE: target.mk + +ALL : ALLTAR + +# --- subsequent tests --------------------------------------------- + +.IF "$(OOO_SUBSEQUENT_TESTS)" != "" + +.INCLUDE: installationtest.mk -run: \ - CheckAccessibleStatusBarItem +ALLTAR : javatest -CheckAccessibleStatusBar: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckAccessibleStatusBar + # Sample how to debug + # JAVAIFLAGS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y -CheckAccessibleStatusBarItem: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).CheckAccessibleStatusBarItem +.END # "$(OOO_SUBSEQUENT_TESTS)" == "" +.END # ELSE "$(OOO_JUNIT_JAR)" != "" diff --git a/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java b/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java deleted file mode 100644 index 654f5ec69da5..000000000000 --- a/toolkit/qa/complex/xunitconversion/XUnitConversionTest.java +++ /dev/null @@ -1,222 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -package complex.xunitconversion; - -import com.sun.star.awt.XUnitConversion; -import com.sun.star.uno.UnoRuntime; -import complexlib.ComplexTestCase; -import com.sun.star.awt.XWindow; -import com.sun.star.lang.XMultiServiceFactory; -import com.sun.star.awt.XWindowPeer; - -import util.DesktopTools; - -/** - * This complex test is only for testing the com.sun.star.awt.XUnitConversion methods - * These are converter methods to get the size of a well known awt component - * in a com.sun.star.util.MeasureUnit you want. - * You don't need to know the factors to calculate by hand. - * - * @author ll93751 - */ -public class XUnitConversionTest extends ComplexTestCase -{ - public String[] getTestMethodNames() - { - return new String[]{"testXUnitConversion"}; // function name of the test method - } - - /** - * returns the delta value between a and b - * @param a - * @param b - * @return - */ - private int delta(int a, int b) - { - final int n = Math.abs(a - b); - return n; - } - - private XUnitConversion m_xConversion = null; - - /** - * Not really a check, - * only a simple test call to convertSizeToLogic(...) with different parameters - * @param _aSize - * @param _aMeasureUnit - * @param _sEinheit - */ - private void checkSize(com.sun.star.awt.Size _aSize, short _aMeasureUnit, String _sEinheit) - { - try - { - com.sun.star.awt.Size aSizeIn = m_xConversion.convertSizeToLogic(_aSize, _aMeasureUnit); - log.println("Window size:"); - log.println("Width:" + aSizeIn.Width + " " + _sEinheit); - log.println("Height:" + aSizeIn.Height + " " + _sEinheit); - log.println(""); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - log.println("Caught IllegalArgumentException in convertSizeToLogic with '" + _sEinheit + "' " + e.getMessage()); - } - } - -/** - * The real test function - * 1. try to get the XMultiServiceFactory of an already running office. Therefore make sure an (open|star)office is running with - * parameters like -accept="socket,host=localhost,port=8100;urp;" - * 2. try to create an empty window - * 3. try to convert the WindowPeer to an XWindow - * 4. try to resize and move the window to an other position, so we get a well knowing position and size. - * 5. run some more tests - * - * If no test fails, the test is well done and returns with 'PASSED, OK' - * - */ public void testXUnitConversion() - { - XMultiServiceFactory xMSF = (XMultiServiceFactory) param.getMSF(); - assure("failed: There is no office.", xMSF != null); - - // create a window - XWindowPeer xWindowPeer = DesktopTools.createFloatingWindow(xMSF); - assure("failed: there is no window peer", xWindowPeer != null); - - - // resize and move the window to a well known position and size - XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class, xWindowPeer); - assure("failed: there is no window, cast wrong?", xWindow != null); - - xWindow.setVisible(Boolean.TRUE); - - int x = 100; - int y = 100; - int width = 640; - int height = 480; - xWindow.setPosSize(x, y, width, height, com.sun.star.awt.PosSize.POSSIZE); - - com.sun.star.awt.Rectangle aRect = xWindow.getPosSize(); - com.sun.star.awt.Point aPoint = new com.sun.star.awt.Point(aRect.X, aRect.Y); - com.sun.star.awt.Size aSize = new com.sun.star.awt.Size(aRect.Width, aRect.Height); - - log.println("Window position and size in pixel:"); - log.println("X:" + aPoint.X); - log.println("Y:" + aPoint.Y); - log.println("Width:" + aSize.Width); - log.println("Height:" + aSize.Height); - log.println(""); - - assure("Window pos size wrong", aSize.Width == width && aSize.Height == height && aPoint.X == x && aPoint.Y == y); - - // XToolkit aToolkit = xWindowPeer.getToolkit(); - m_xConversion = (XUnitConversion) UnoRuntime.queryInterface(XUnitConversion.class, xWindowPeer); - - // try to get the position of the window in 1/100mm with the XUnitConversion method - try - { - com.sun.star.awt.Point aPointInMM_100TH = m_xConversion.convertPointToLogic(aPoint, com.sun.star.util.MeasureUnit.MM_100TH); - log.println("Window position:"); - log.println("X:" + aPointInMM_100TH.X + " 1/100mm"); - log.println("Y:" + aPointInMM_100TH.Y + " 1/100mm"); - log.println(""); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - assure("failed: IllegalArgumentException caught in convertPointToLogic " + e.getMessage(), Boolean.FALSE); - } - - // try to get the size of the window in 1/100mm with the XUnitConversion method - com.sun.star.awt.Size aSizeInMM_100TH = null; - com.sun.star.awt.Size aSizeInMM_10TH = null; - try - { - aSizeInMM_100TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_100TH); - log.println("Window size:"); - log.println("Width:" + aSizeInMM_100TH.Width + " 1/100mm"); - log.println("Height:" + aSizeInMM_100TH.Height + " 1/100mm"); - log.println(""); - - // try to get the size of the window in 1/10mm with the XUnitConversion method - - aSizeInMM_10TH = m_xConversion.convertSizeToLogic(aSize, com.sun.star.util.MeasureUnit.MM_10TH); - log.println("Window size:"); - log.println("Width:" + aSizeInMM_10TH.Width + " 1/10mm"); - log.println("Height:" + aSizeInMM_10TH.Height + " 1/10mm"); - log.println(""); - - // check the size with a delta which must be smaller a given difference - assure("Size.Width not correct", delta(aSizeInMM_100TH.Width, aSizeInMM_10TH.Width * 10) < 10); - assure("Size.Height not correct", delta(aSizeInMM_100TH.Height, aSizeInMM_10TH.Height * 10) < 10); - - // new - checkSize(aSize, com.sun.star.util.MeasureUnit.PIXEL, "pixel"); - checkSize(aSize, com.sun.star.util.MeasureUnit.APPFONT, "appfont"); - checkSize(aSize, com.sun.star.util.MeasureUnit.SYSFONT, "sysfont"); - - // simply check some more parameters - checkSize(aSize, com.sun.star.util.MeasureUnit.MM, "mm"); - checkSize(aSize, com.sun.star.util.MeasureUnit.CM, "cm"); - checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_1000TH, "1/1000inch"); - checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_100TH, "1/100inch"); - checkSize(aSize, com.sun.star.util.MeasureUnit.INCH_10TH, "1/10inch"); - checkSize(aSize, com.sun.star.util.MeasureUnit.INCH, "inch"); - // checkSize(aSize, com.sun.star.util.MeasureUnit.M, "m"); - checkSize(aSize, com.sun.star.util.MeasureUnit.POINT, "point"); - checkSize(aSize, com.sun.star.util.MeasureUnit.TWIP, "twip"); - // checkSize(aSize, com.sun.star.util.MeasureUnit.KM, "km"); - // checkSize(aSize, com.sun.star.util.MeasureUnit.PICA, "pica"); - // checkSize(aSize, com.sun.star.util.MeasureUnit.FOOT, "foot"); - // checkSize(aSize, com.sun.star.util.MeasureUnit.MILE, "mile"); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - assure("failed: IllegalArgumentException caught in convertSizeToLogic " + e.getMessage(), Boolean.FALSE); - } - - // convert the 1/100mm window size back to pixel - try - { - com.sun.star.awt.Size aNewSize = m_xConversion.convertSizeToPixel(aSizeInMM_100TH, com.sun.star.util.MeasureUnit.MM_100TH); - log.println("Window size:"); - log.println("Width:" + aNewSize.Width + " pixel"); - log.println("Height:" + aNewSize.Height + " pixel"); - - // assure the pixels are the same as we already know - assure("failed: Size from pixel to 1/100mm to pixel", aSize.Width == aNewSize.Width && aSize.Height == aNewSize.Height); - } - catch (com.sun.star.lang.IllegalArgumentException e) - { - assure("failed: IllegalArgumentException caught in convertSizeToPixel " + e.getMessage(), Boolean.FALSE); - } - - // close the window. - // IMHO a little bit stupid, but the XWindow doesn't support a XCloseable interface - xWindow.dispose(); - } -} diff --git a/toolkit/qa/complex/xunitconversion/makefile.mk b/toolkit/qa/complex/xunitconversion/makefile.mk deleted file mode 100644 index 18b59ee19f18..000000000000 --- a/toolkit/qa/complex/xunitconversion/makefile.mk +++ /dev/null @@ -1,77 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - -PRJ = ..$/..$/.. -TARGET = XUnitConversionTest -PRJNAME = $(TARGET) -PACKAGE = complex$/xunitconversion - -# --- Settings ----------------------------------------------------- -.INCLUDE: settings.mk - - -#----- compile .java files ----------------------------------------- - -JARFILES = ridl.jar unoil.jar jurt.jar juh.jar java_uno.jar OOoRunner.jar -JAVAFILES = XUnitConversionTest.java -JAVACLASSFILES = $(foreach,i,$(JAVAFILES) $(CLASSDIR)$/$(PACKAGE)$/$(i:b).class) -SUBDIRS = - -#----- make a jar from compiled files ------------------------------ - -MAXLINELENGTH = 100000 - -JARCLASSDIRS = $(PACKAGE) -JARTARGET = $(TARGET).jar -JARCOMPRESS = TRUE - -# --- Parameters for the test -------------------------------------- - -# start an office if the parameter is set for the makefile -.IF "$(OFFICE)" == "" -CT_APPEXECCOMMAND = -.ELSE -CT_APPEXECCOMMAND = -AppExecutionCommand "$(OFFICE)$/soffice -accept=socket,host=localhost,port=8100;urp;" -.ENDIF - -# test base is java complex -CT_TESTBASE = -tb java_complex - -# build up package name with "." instead of $/ -CT_PACKAGE = -o $(PACKAGE:s\$/\.\) - -# start the runner application -CT_APP = org.openoffice.Runner - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk - -run: $(JAVAFILES) XUnitConversionTest - -XUnitConversionTest: - +java -cp $(CLASSPATH) $(CT_APP) $(CT_APPEXECCOMMAND) $(CT_TESTBASE) $(CT_PACKAGE).XUnitConversionTest diff --git a/toolkit/qa/unoapi/Test.java b/toolkit/qa/unoapi/Test.java index f27d882314d2..0543fee83f9f 100644 --- a/toolkit/qa/unoapi/Test.java +++ b/toolkit/qa/unoapi/Test.java @@ -27,6 +27,7 @@ package org.openoffice.toolkit.qa.unoapi; import org.openoffice.Runner; import org.openoffice.test.OfficeConnection; +import org.openoffice.test.Argument; import static org.junit.Assert.*; public final class Test { @@ -43,8 +44,8 @@ public final class Test { @org.junit.Test public void test() { assertTrue( Runner.run( - "-sce", "toolkit.sce", "-xcl", "knownissues.xcl", "-tdoc", - "testdocuments", "-cs", connection.getDescription())); + "-sce", Argument.get("sce"), "-xcl", Argument.get("xcl"), "-tdoc", + Argument.get("tdoc"), "-cs", connection.getDescription())); } private final OfficeConnection connection = new OfficeConnection(); diff --git a/toolkit/qa/unoapi/knownissues.xcl b/toolkit/qa/unoapi/knownissues.xcl index 429d7693c833..273b4b72dbe2 100644 --- a/toolkit/qa/unoapi/knownissues.xcl +++ b/toolkit/qa/unoapi/knownissues.xcl @@ -178,7 +178,6 @@ toolkit.UnoControlDialogModel::com::sun::star::lang::XComponent toolkit.UnoControlFileControlModel::com::sun::star::lang::XComponent toolkit.UnoControlGroupBox::com::sun::star::lang::XComponent toolkit.UnoControlContainer::com::sun::star::lang::XComponent -toolkit.MutableTreeDataModel::com::sun::star::lang::XComponent toolkit.UnoControlFixedText::com::sun::star::lang::XComponent toolkit.UnoControlListBox::com::sun::star::lang::XComponent toolkit.UnoControlCheckBoxModel::com::sun::star::lang::XComponent @@ -241,12 +240,21 @@ toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleValue toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleEventBroadcaster toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleSelection -### i111076 ### -toolkit.Toolkit::com::sun::star::awt::XDataTransferProviderAccess - ### i111113 ### toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleComponent toolkit.AccessibleStatusBarItem::com::sun::star::accessibility::XAccessibleContext ### i111195 ### toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleValue + +### i113489 ### +toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleText +toolkit.AccessibleMenuBar::com::sun::star::accessibility::XAccessibleComponent +toolkit.AccessibleMenuSeparator::com::sun::star::accessibility::XAccessibleComponent + +### i114213 ### +toolkit.AccessibleMenu::com::sun::star::accessibility::XAccessibleSelection + +### i114636 ### +toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleAction +toolkit.AccessibleScrollBar::com::sun::star::accessibility::XAccessibleContext diff --git a/toolkit/qa/unoapi/makefile.mk b/toolkit/qa/unoapi/makefile.mk deleted file mode 100644 index 9517601c3917..000000000000 --- a/toolkit/qa/unoapi/makefile.mk +++ /dev/null @@ -1,48 +0,0 @@ -#************************************************************************* -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -#***********************************************************************/ - -.IF "$(OOO_SUBSEQUENT_TESTS)" == "" -nothing .PHONY: -.ELSE - -PRJ = ../.. -PRJNAME = toolkit -TARGET = qa_unoapi - -.IF "$(OOO_JUNIT_JAR)" != "" -PACKAGE = org/openoffice/toolkit/qa/unoapi -JAVATESTFILES = Test.java -JAVAFILES = $(JAVATESTFILES) -JARFILES = OOoRunner.jar ridl.jar test.jar -EXTRAJARFILES = $(OOO_JUNIT_JAR) -.END - -.INCLUDE: settings.mk -.INCLUDE: target.mk -.INCLUDE: installationtest.mk - -ALLTAR : javatest - -.END diff --git a/toolkit/qa/unoapi/toolkit.sce b/toolkit/qa/unoapi/toolkit.sce index 5a148feee573..00af010d23d6 100644 --- a/toolkit/qa/unoapi/toolkit.sce +++ b/toolkit/qa/unoapi/toolkit.sce @@ -8,10 +8,10 @@ #i86110 -o toolkit.AccessibleList #i86110 -o toolkit.AccessibleListBox #i86110 -o toolkit.AccessibleListItem -#i111047# -o toolkit.AccessibleMenu -#i111047# -o toolkit.AccessibleMenuBar +-o toolkit.AccessibleMenu +-o toolkit.AccessibleMenuBar #i86009 -o toolkit.AccessibleMenuItem -#i111047# -o toolkit.AccessibleMenuSeparator +-o toolkit.AccessibleMenuSeparator #i52607 -o toolkit.AccessiblePopupMenu #i86107,i86110 -o toolkit.AccessibleRadioButton -o toolkit.AccessibleScrollBar |