Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
cc0a4e48
Kaydet (Commit)
cc0a4e48
authored
Kas 13, 2009
tarafından
Frank Schoenheit [fs]
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
some refactoring, done during creation of a test case for #i106643#
üst
fe866ade
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
69 additions
and
139 deletions
+69
-139
DocumentViewHelper.java
forms/qa/integration/forms/DocumentViewHelper.java
+2
-3
FormControlTest.java
forms/qa/integration/forms/FormControlTest.java
+5
-4
FormLayer.java
forms/qa/integration/forms/FormLayer.java
+15
-15
FormPropertyBags.java
forms/qa/integration/forms/FormPropertyBags.java
+3
-7
ListSelection.java
forms/qa/integration/forms/ListSelection.java
+9
-77
MasterDetailForms.java
forms/qa/integration/forms/MasterDetailForms.java
+19
-27
TestCase.java
forms/qa/integration/forms/TestCase.java
+11
-2
dbfTools.java
forms/qa/integration/forms/dbfTools.java
+5
-4
No files found.
forms/qa/integration/forms/DocumentViewHelper.java
Dosyayı görüntüle @
cc0a4e48
...
...
@@ -190,10 +190,9 @@ public class DocumentViewHelper
/* ------------------------------------------------------------------ */
/** retrieves the form controller for a given logical form
*/
public
XFormController
getFormController
(
XPropertySe
t
_form
)
public
XFormController
getFormController
(
Objec
t
_form
)
{
XFormLayerAccess
formLayerAccess
=
(
XFormLayerAccess
)
query
(
XFormLayerAccess
.
class
);
return
formLayerAccess
.
getFormController
(
(
XForm
)
UnoRuntime
.
queryInterface
(
XForm
.
class
,
_form
)
);
return
getFormController
(
UnoRuntime
.
queryInterface
(
XForm
.
class
,
_form
));
}
/* ------------------------------------------------------------------ */
...
...
forms/qa/integration/forms/FormControlTest.java
Dosyayı görüntüle @
cc0a4e48
...
...
@@ -52,6 +52,7 @@ import com.sun.star.util.URL;
import
com.sun.star.util.XCloseable
;
import
com.sun.star.util.XURLTransformer
;
import
connectivity.tools.HsqlDatabase
;
import
connectivity.tools.sdb.Connection
;
import
java.io.FileOutputStream
;
...
...
@@ -609,8 +610,8 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
/* ------------------------------------------------------------------ */
private
boolean
ensureTables
()
throws
com
.
sun
.
star
.
uno
.
Exception
,
java
.
lang
.
Exception
{
XConnection
xConn
=
m_dataSource
.
getConnection
(
""
,
""
);
assure
(
"could not connect to the data source"
,
xCon
n
!=
null
);
Connection
connection
=
new
Connection
(
m_dataSource
.
getConnection
(
""
,
""
)
);
assure
(
"could not connect to the data source"
,
connectio
n
!=
null
);
// drop the table, if it already exists
if
(
!
implExecuteStatement
(
"DROP TABLE \""
+
s_tableName
+
"\" IF EXISTS"
)
...
...
@@ -630,10 +631,10 @@ public class FormControlTest extends complexlib.ComplexTestCase implements XSQLE
return
false
;
}
m_databaseDocument
.
getDataSource
().
refreshTables
(
xConn
);
connection
.
refreshTables
(
);
// do not need the connection anymore
dbfTools
.
disposeComponent
(
xConn
);
connection
.
close
(
);
return
true
;
}
...
...
forms/qa/integration/forms/FormLayer.java
Dosyayı görüntüle @
cc0a4e48
...
...
@@ -31,7 +31,6 @@ package integration.forms;
import
com.sun.star.accessibility.XAccessible
;
import
com.sun.star.accessibility.XAccessibleEditableText
;
import
com.sun.star.container.XNameAccess
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.beans.XPropertySet
;
...
...
@@ -44,6 +43,7 @@ import com.sun.star.awt.Size;
import
com.sun.star.awt.Point
;
import
com.sun.star.awt.VisualEffect
;
import
com.sun.star.awt.XControlModel
;
import
com.sun.star.container.XNameAccess
;
import
com.sun.star.text.TextContentAnchorType
;
import
com.sun.star.drawing.XDrawPage
;
...
...
@@ -99,9 +99,9 @@ public class FormLayer
int
nYPos
,
int
nWidth
,
int
nHeight
,
Object
_parentForm
)
throws
java
.
lang
.
Exception
{
// let the document create a shape
XMultiServiceFactory
xDocAsFactory
=
(
XMultiServiceFactory
)
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
xDocAsFactory
=
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
.
class
,
m_document
.
getDocument
()
);
XControlShape
xShape
=
(
XControlShape
)
UnoRuntime
.
queryInterface
(
XControlShape
.
class
,
XControlShape
xShape
=
UnoRuntime
.
queryInterface
(
XControlShape
.
class
,
xDocAsFactory
.
createInstance
(
"com.sun.star.drawing.ControlShape"
)
);
// position and size of the shape
...
...
@@ -115,7 +115,7 @@ public class FormLayer
// create the form component (the model of a form control)
String
sQualifiedComponentName
=
"com.sun.star.form.component."
+
sFormComponentService
;
XControlModel
xModel
=
(
XControlModel
)
UnoRuntime
.
queryInterface
(
XControlModel
.
class
,
XControlModel
xModel
=
UnoRuntime
.
queryInterface
(
XControlModel
.
class
,
m_document
.
getOrb
().
createInstance
(
sQualifiedComponentName
)
);
// insert the model into the form component hierarchy, if the caller gave us a location
...
...
@@ -125,7 +125,7 @@ public class FormLayer
if
(
_parentForm
instanceof
XIndexContainer
)
parentForm
=
(
XIndexContainer
)
_parentForm
;
else
parentForm
=
(
XIndexContainer
)
UnoRuntime
.
queryInterface
(
XIndexContainer
.
class
,
_parentForm
);
parentForm
=
UnoRuntime
.
queryInterface
(
XIndexContainer
.
class
,
_parentForm
);
parentForm
.
insertByIndex
(
parentForm
.
getCount
(),
xModel
);
}
...
...
@@ -135,7 +135,7 @@ public class FormLayer
// add the shape to the shapes collection of the document
XDrawPage
pageWhereToInsert
=
(
m_page
!=
null
)
?
m_page
:
m_document
.
getMainDrawPage
();
XShapes
xDocShapes
=
(
XShapes
)
UnoRuntime
.
queryInterface
(
XShapes
.
class
,
pageWhereToInsert
);
XShapes
xDocShapes
=
UnoRuntime
.
queryInterface
(
XShapes
.
class
,
pageWhereToInsert
);
xDocShapes
.
add
(
xShape
);
// and outta here with the XPropertySet interface of the model
...
...
@@ -226,7 +226,7 @@ public class FormLayer
@return
the control model of the created data input field
*/
public
XPropertySet
insertControlLine
(
String
sControlType
,
String
sFieldName
,
String
sC
ontrolNamePostfix
,
public
XPropertySet
insertControlLine
(
String
sControlType
,
String
sFieldName
,
String
_c
ontrolNamePostfix
,
int
nXPos
,
int
nYPos
,
int
nHeight
)
throws
java
.
lang
.
Exception
{
...
...
@@ -247,8 +247,10 @@ public class FormLayer
xFieldModel
.
setPropertyValue
(
"LabelControl"
,
xLabelModel
);
// some names, so later on we can find them
xLabelModel
.
setPropertyValue
(
"Name"
,
sFieldName
+
sControlNamePostfix
+
"_Label"
);
xFieldModel
.
setPropertyValue
(
"Name"
,
sFieldName
+
sControlNamePostfix
);
if
(
_controlNamePostfix
==
null
)
_controlNamePostfix
=
""
;
xLabelModel
.
setPropertyValue
(
"Name"
,
sFieldName
+
_controlNamePostfix
+
"_Label"
);
xFieldModel
.
setPropertyValue
(
"Name"
,
sFieldName
+
_controlNamePostfix
);
return
xFieldModel
;
}
...
...
@@ -282,8 +284,7 @@ public class FormLayer
*/
public
XPropertySet
getRadioModelByRefValue
(
XPropertySet
form
,
String
name
,
String
refValue
)
throws
com
.
sun
.
star
.
uno
.
Exception
,
java
.
lang
.
Exception
{
XIndexAccess
indexAccess
=
(
XIndexAccess
)
UnoRuntime
.
queryInterface
(
XIndexAccess
.
class
,
form
);
XIndexAccess
indexAccess
=
UnoRuntime
.
queryInterface
(
XIndexAccess
.
class
,
form
);
for
(
int
i
=
0
;
i
<
indexAccess
.
getCount
();
++
i
)
{
...
...
@@ -307,8 +308,7 @@ public class FormLayer
*/
public
XPropertySet
getRadioModelByTag
(
XPropertySet
form
,
String
name
,
String
tag
)
throws
com
.
sun
.
star
.
uno
.
Exception
,
java
.
lang
.
Exception
{
XIndexAccess
indexAccess
=
(
XIndexAccess
)
UnoRuntime
.
queryInterface
(
XIndexAccess
.
class
,
form
);
XIndexAccess
indexAccess
=
UnoRuntime
.
queryInterface
(
XIndexAccess
.
class
,
form
);
for
(
int
i
=
0
;
i
<
indexAccess
.
getCount
();
++
i
)
{
...
...
@@ -349,10 +349,10 @@ public class FormLayer
// doing a user input, as the latter will trigger a lot of notifications, which the forms runtime environment
// (namely the FormController) relies on to notice that the control changed.
// Instead, we use the Accessibility interfaces of the control to simulate text input
XAccessible
formattedAccessible
=
(
XAccessible
)
UnoRuntime
.
queryInterface
(
XAccessible
.
class
,
XAccessible
formattedAccessible
=
UnoRuntime
.
queryInterface
(
XAccessible
.
class
,
m_document
.
getCurrentView
().
getControl
(
controlModel
)
);
XAccessibleEditableText
textAccess
=
(
XAccessibleEditableText
)
UnoRuntime
.
queryInterface
(
XAccessibleEditableText
.
class
,
XAccessibleEditableText
textAccess
=
UnoRuntime
.
queryInterface
(
XAccessibleEditableText
.
class
,
formattedAccessible
.
getAccessibleContext
()
);
textAccess
.
setText
(
text
);
}
...
...
forms/qa/integration/forms/FormPropertyBags.java
Dosyayı görüntüle @
cc0a4e48
...
...
@@ -47,8 +47,6 @@ import com.sun.star.lang.XMultiServiceFactory;
import
com.sun.star.util.XCloseable
;
import
integration.forms.DocumentHelper
;
public
class
FormPropertyBags
extends
complexlib
.
ComplexTestCase
implements
XPropertyChangeListener
{
private
DocumentHelper
m_document
;
...
...
@@ -90,8 +88,7 @@ public class FormPropertyBags extends complexlib.ComplexTestCase implements XPro
{
if
(
m_document
!=
null
)
{
XCloseable
closeDoc
=
(
XCloseable
)
UnoRuntime
.
queryInterface
(
XCloseable
.
class
,
m_document
.
getDocument
()
);
XCloseable
closeDoc
=
UnoRuntime
.
queryInterface
(
XCloseable
.
class
,
m_document
.
getDocument
()
);
closeDoc
.
close
(
true
);
}
}
...
...
@@ -108,7 +105,7 @@ public class FormPropertyBags extends complexlib.ComplexTestCase implements XPro
XPropertySet
textFieldModel
=
m_formLayer
.
createControlAndShape
(
"DatabaseTextField"
,
10
,
10
,
25
,
6
);
// check whether adding new properties is successful
XPropertyContainer
propContainer
=
(
XPropertyContainer
)
UnoRuntime
.
queryInterface
(
XPropertyContainer
propContainer
=
UnoRuntime
.
queryInterface
(
XPropertyContainer
.
class
,
textFieldModel
);
assure
(
"XPropertyContainer not supported!"
,
propContainer
!=
null
);
...
...
@@ -166,8 +163,7 @@ public class FormPropertyBags extends complexlib.ComplexTestCase implements XPro
private
void
impl_checkPropertyPersistence
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
// store the document
XStorable
store
=
(
XStorable
)
UnoRuntime
.
queryInterface
(
XStorable
.
class
,
m_document
.
getDocument
()
);
XStorable
store
=
UnoRuntime
.
queryInterface
(
XStorable
.
class
,
m_document
.
getDocument
()
);
String
documentURL
=
util
.
utils
.
getOfficeTemp
(
m_orb
)
+
"document.odt"
;
PropertyValue
[]
storeArguments
=
new
PropertyValue
[]
{
new
PropertyValue
()
};
storeArguments
[
0
].
Name
=
"FilterName"
;
...
...
forms/qa/integration/forms/ListSelection.java
Dosyayı görüntüle @
cc0a4e48
...
...
@@ -30,7 +30,6 @@
package
integration
.
forms
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.beans.XPropertySet
;
import
com.sun.star.sheet.XSpreadsheet
;
import
com.sun.star.sheet.XSpreadsheets
;
...
...
@@ -48,15 +47,10 @@ import com.sun.star.script.ScriptEventDescriptor;
import
com.sun.star.accessibility.XAccessible
;
import
com.sun.star.accessibility.XAccessibleContext
;
import
com.sun.star.accessibility.XAccessibleSelection
;
import
com.sun.star.accessibility.XAccessibleAction
;
import
com.sun.star.frame.XStorable
;
import
integration.forms.DocumentHelper
;
public
class
ListSelection
extends
integration
.
forms
.
TestCase
implements
com
.
sun
.
star
.
awt
.
XItemListener
public
class
ListSelection
extends
integration
.
forms
.
TestCase
{
private
final
static
boolean
m_useJavaCallbacks
=
false
;
/** Creates a new instance of ListSelection */
public
ListSelection
()
{
...
...
@@ -98,7 +92,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
{
log
.
println
(
"Round "
+
(
i
+
1
)
+
" of "
+
runs
);
prepareDocument
();
clickThe
ListBox
();
impl_click
ListBox
();
synchronized
(
this
)
{
this
.
wait
(
1000
);
}
closeDocument
();
}
...
...
@@ -106,7 +100,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
}
/* ------------------------------------------------------------------ */
final
pr
otected
void
clickThe
ListBox
()
final
pr
ivate
void
impl_click
ListBox
()
{
try
{
...
...
@@ -123,13 +117,6 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
XAccessible
.
class
,
getListBoxControl
(
activeSheet
)
);
XAccessibleContext
context
=
accessibleListBox
.
getAccessibleContext
();
// open the popup of the list box (not really necessary, but to better
// simlate user action ...)
/* XAccessibleAction listBoxActions = (XAccessibleAction)UnoRuntime.queryInterface(
XAccessibleAction.class, context );
listBoxActions.doAccessibleAction( 0 );
*/
// the first "accessible child" of a list box is its list
XAccessibleSelection
accessibleList
=
(
XAccessibleSelection
)
UnoRuntime
.
queryInterface
(
XAccessibleSelection
.
class
,
context
.
getAccessibleChild
(
1
)
);
...
...
@@ -158,7 +145,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
}
/* ------------------------------------------------------------------ */
final
pr
otected
void
create
ListenerScript
()
final
pr
ivate
void
impl_setup
ListenerScript
()
{
try
{
...
...
@@ -203,7 +190,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
}
/* ------------------------------------------------------------------ */
final
pr
otected
void
assignCallback
Script
(
XPropertySet
controlModel
,
String
interfaceName
,
String
interfaceMethod
,
String
scriptCode
)
final
pr
ivate
void
impl_assignStarBasic
Script
(
XPropertySet
controlModel
,
String
interfaceName
,
String
interfaceMethod
,
String
scriptCode
)
{
try
{
...
...
@@ -240,8 +227,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
protected
void
prepareDocument
()
throws
com
.
sun
.
star
.
uno
.
Exception
,
java
.
lang
.
Exception
{
super
.
prepareDocument
();
if
(
!
m_useJavaCallbacks
)
createListenerScript
();
impl_setupListenerScript
();
SpreadsheetDocument
document
=
(
SpreadsheetDocument
)
m_document
;
XSpreadsheets
sheets
=
document
.
getSheets
();
...
...
@@ -264,7 +250,7 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
XPropertySet
buttonModel
=
m_formLayer
.
createControlAndShape
(
"CommandButton"
,
10
,
10
+
i
*
10
,
30
,
8
);
assignCallback
Script
(
buttonModel
,
"XActionListener"
,
"actionPerformed"
,
"document:default.callbacks.onButtonClicked"
);
impl_assignStarBasic
Script
(
buttonModel
,
"XActionListener"
,
"actionPerformed"
,
"document:default.callbacks.onButtonClicked"
);
}
// and a list box
...
...
@@ -273,25 +259,15 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
listBox
.
setPropertyValue
(
"StringItemList"
,
newSheetNames
);
listBox
.
setPropertyValue
(
"Name"
,
"ListBox"
);
if
(
!
m_useJavaCallbacks
)
assignCallbackScript
(
listBox
,
"XItemListener"
,
"itemStateChanged"
,
"document:default.callbacks.onListBoxSelected"
);
impl_assignStarBasicScript
(
listBox
,
"XItemListener"
,
"itemStateChanged"
,
"document:default.callbacks.onListBoxSelected"
);
// clone this sheet
for
(
short
i
=
1
;
i
<
newSheetNames
.
length
;
++
i
)
sheets
.
copyByName
(
newSheetNames
[
0
],
newSheetNames
[
i
],
(
short
)
i
);
sheets
.
copyByName
(
newSheetNames
[
0
],
newSheetNames
[
i
],
i
);
// switch the thing to alive mode
m_document
.
getCurrentView
().
toggleFormDesignMode
();
// add to the list box control as item listener
if
(
m_useJavaCallbacks
)
{
XControl
control
=
m_document
.
getCurrentView
().
getControl
(
listBox
);
XListBox
listBoxControl
=
(
XListBox
)
UnoRuntime
.
queryInterface
(
XListBox
.
class
,
control
);
listBoxControl
.
addItemListener
(
this
);
}
try
{
XStorable
storable
=
(
XStorable
)
m_document
.
query
(
XStorable
.
class
);
...
...
@@ -322,48 +298,4 @@ public class ListSelection extends integration.forms.TestCase implements com.sun
return
(
XListBox
)
UnoRuntime
.
queryInterface
(
XListBox
.
class
,
m_document
.
getCurrentView
().
getControl
(
getListBoxModel
(
sheet
)
)
);
}
/* ------------------------------------------------------------------ */
public
void
itemStateChanged
(
com
.
sun
.
star
.
awt
.
ItemEvent
event
)
throws
com
.
sun
.
star
.
uno
.
RuntimeException
{
try
{
// get the selected string
XControl
control
=
(
XControl
)
UnoRuntime
.
queryInterface
(
XControl
.
class
,
event
.
Source
);
XPropertySet
model
=
dbfTools
.
queryPropertySet
(
control
.
getModel
()
);
String
[]
entries
=
(
String
[])
model
.
getPropertyValue
(
"StringItemList"
);
String
selectedEntry
=
entries
[
event
.
Selected
];
// activate this sheet
SpreadsheetDocument
document
=
(
SpreadsheetDocument
)
m_document
;
XSpreadsheet
sheet
=
(
XSpreadsheet
)
UnoRuntime
.
queryInterface
(
XSpreadsheet
.
class
,
document
.
getSheets
().
getByName
(
selectedEntry
)
);
XSpreadsheetView
view
=
(
XSpreadsheetView
)
m_document
.
getCurrentView
().
query
(
XSpreadsheetView
.
class
);
view
.
setActiveSheet
(
sheet
);
if
(
m_useJavaCallbacks
)
{
// after we switched to another sheet, we need to register at its list box
// control, again. The reason is that controls exist as long as their sheet is active.
XListBox
listBoxControl
=
getListBoxControl
(
sheet
);
listBoxControl
.
addItemListener
(
this
);
// in the list box of this new sheet, select its name. Everything else
// is way too confusing
listBoxControl
.
selectItem
(
selectedEntry
,
true
);
// don't do it. It deadlocks :(
}
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
e
.
printStackTrace
(
System
.
err
);
}
}
/* ------------------------------------------------------------------ */
public
void
disposing
(
com
.
sun
.
star
.
lang
.
EventObject
rEvent
)
throws
com
.
sun
.
star
.
uno
.
RuntimeException
{
// not interested in by now
}
}
forms/qa/integration/forms/MasterDetailForms.java
Dosyayı görüntüle @
cc0a4e48
...
...
@@ -122,28 +122,27 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
_databaseDocument
.
executeSQL
(
"INSERT INTO \"detail\" VALUES ( 2, 1, 1, 'record 1.1 (2)')"
);
_databaseDocument
.
executeSQL
(
"INSERT INTO \"detail\" VALUES ( 3, 1, 2, 'record 1.2 (1)')"
);
_databaseDocument
.
getDataSource
().
refreshTables
(
_databaseDocument
.
defaultConnection
()
);
_databaseDocument
.
defaultConnection
().
refreshTables
(
);
}
/* ------------------------------------------------------------------ */
private
void
impl_createForms
(
final
HsqlDatabase
_databaseDocument
)
throws
com
.
sun
.
star
.
uno
.
Exception
{
m_masterForm
=
dbfTools
.
queryPropertySet
(
m_orb
.
createInstance
(
"com.sun.star.form.component.DataForm"
)
);
m_masterForm
.
setPropertyValue
(
"ActiveConnection"
,
_databaseDocument
.
defaultConnection
()
);
m_masterForm
.
setPropertyValue
(
"ActiveConnection"
,
_databaseDocument
.
defaultConnection
()
.
getXConnection
()
);
m_masterForm
.
setPropertyValue
(
"CommandType"
,
new
Integer
(
com
.
sun
.
star
.
sdb
.
CommandType
.
TABLE
)
);
m_masterForm
.
setPropertyValue
(
"Command"
,
"master"
);
m_masterResult
=
new
ResultSet
(
m_masterForm
);
m_detailForm
=
dbfTools
.
queryPropertySet
(
m_orb
.
createInstance
(
"com.sun.star.form.component.DataForm"
)
);
m_detailForm
.
setPropertyValue
(
"ActiveConnection"
,
_databaseDocument
.
defaultConnection
()
);
m_detailForm
.
setPropertyValue
(
"ActiveConnection"
,
_databaseDocument
.
defaultConnection
()
.
getXConnection
()
);
m_detailForm
.
setPropertyValue
(
"CommandType"
,
new
Integer
(
com
.
sun
.
star
.
sdb
.
CommandType
.
TABLE
)
);
m_detailForm
.
setPropertyValue
(
"Command"
,
"detail"
);
m_detailResult
=
new
ResultSet
(
m_detailForm
);
XNameContainer
masterContainer
=
(
XNameContainer
)
UnoRuntime
.
queryInterface
(
XNameContainer
.
class
,
m_masterForm
);
XNameContainer
masterContainer
=
UnoRuntime
.
queryInterface
(
XNameContainer
.
class
,
m_masterForm
);
masterContainer
.
insertByName
(
"slave"
,
m_detailForm
);
}
...
...
@@ -162,8 +161,8 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
m_detailForm
.
setPropertyValue
(
"MasterFields"
,
new
String
[]
{
"ID1"
,
"ID2"
}
);
m_detailForm
.
setPropertyValue
(
"DetailFields"
,
new
String
[]
{
"FK_ID1"
,
"FK_ID2"
}
);
XLoadable
loadMaster
=
(
XLoadable
)
UnoRuntime
.
queryInterface
(
XLoadable
.
class
,
m_masterForm
);
XLoadable
loadDetail
=
(
XLoadable
)
UnoRuntime
.
queryInterface
(
XLoadable
.
class
,
m_detailForm
);
XLoadable
loadMaster
=
UnoRuntime
.
queryInterface
(
XLoadable
.
class
,
m_masterForm
);
XLoadable
loadDetail
=
UnoRuntime
.
queryInterface
(
XLoadable
.
class
,
m_detailForm
);
loadDetail
.
addLoadListener
(
this
);
// wait until the detail form is loaded
...
...
@@ -227,16 +226,14 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
database
=
new
CRMDatabase
(
m_orb
,
true
);
// create a form document therein
XFormDocumentsSupplier
formDocSupp
=
(
XFormDocumentsSupplier
)
UnoRuntime
.
queryInterface
(
XFormDocumentsSupplier
.
class
,
database
.
getDatabase
().
getModel
()
);
XMultiServiceFactory
formFactory
=
(
XMultiServiceFactory
)
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
.
class
,
formDocSupp
.
getFormDocuments
()
);
XFormDocumentsSupplier
formDocSupp
=
UnoRuntime
.
queryInterface
(
XFormDocumentsSupplier
.
class
,
database
.
getDatabase
().
getModel
()
);
XMultiServiceFactory
formFactory
=
UnoRuntime
.
queryInterface
(
XMultiServiceFactory
.
class
,
formDocSupp
.
getFormDocuments
()
);
NamedValue
[]
loadArgs
=
new
NamedValue
[]
{
new
NamedValue
(
"ActiveConnection"
,
database
.
getConnection
()
),
new
NamedValue
(
"ActiveConnection"
,
database
.
getConnection
()
.
getXConnection
()
),
new
NamedValue
(
"MediaType"
,
"application/vnd.oasis.opendocument.text"
)
};
subComponentCommands
=
(
XCommandProcessor
)
UnoRuntime
.
queryInterface
(
subComponentCommands
=
UnoRuntime
.
queryInterface
(
XCommandProcessor
.
class
,
formFactory
.
createInstanceWithArguments
(
"com.sun.star.sdb.DocumentDefinition"
,
loadArgs
)
);
Command
command
=
new
Command
();
...
...
@@ -244,7 +241,7 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
command
.
Argument
=
new
Short
(
OpenMode
.
DOCUMENT
);
DocumentHelper
subDocument
=
new
DocumentHelper
(
m_orb
,
(
XComponent
)
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
subComponentCommands
.
execute
(
command
,
subComponentCommands
.
createCommandIdentifier
(),
null
)
)
);
...
...
@@ -258,8 +255,7 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
m_masterForm
.
setPropertyValue
(
"CommandType"
,
new
Integer
(
CommandType
.
TABLE
)
);
// create a detail form
m_detailForm
=
(
XPropertySet
)
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
subDocument
.
createSubForm
(
m_masterForm
,
"products"
)
);
m_detailForm
=
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
subDocument
.
createSubForm
(
m_masterForm
,
"products"
)
);
m_detailForm
.
setPropertyValue
(
"Command"
,
"SELECT \"ID\", \"Name\", \"CategoryID\" FROM \"products\""
);
m_detailForm
.
setPropertyValue
(
"CommandType"
,
new
Integer
(
CommandType
.
COMMAND
)
);
m_detailForm
.
setPropertyValue
(
"MasterFields"
,
new
String
[]
{
"ID"
}
);
...
...
@@ -268,8 +264,7 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
// create a grid control in the detail form, with some columns
XPropertySet
gridControlModel
=
formLayer
.
createControlAndShape
(
"GridControl"
,
20
,
40
,
130
,
50
,
m_detailForm
);
gridControlModel
.
setPropertyValue
(
"Name"
,
"product list"
);
XIndexContainer
gridColumns
=
(
XIndexContainer
)
UnoRuntime
.
queryInterface
(
XIndexContainer
.
class
,
gridControlModel
);
XIndexContainer
gridColumns
=
UnoRuntime
.
queryInterface
(
XIndexContainer
.
class
,
gridControlModel
);
impl_createGridColumn
(
gridColumns
,
"TextField"
,
"ID"
);
XPropertySet
nameColumn
=
impl_createGridColumn
(
gridColumns
,
"TextField"
,
"Name"
);
nameColumn
.
setPropertyValue
(
"Width"
,
new
Integer
(
600
)
);
// 6 cm
...
...
@@ -279,7 +274,7 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
m_masterResult
=
new
ResultSet
(
m_masterForm
);
m_detailResult
=
new
ResultSet
(
m_detailForm
);
XLoadable
loadDetail
=
(
XLoadable
)
UnoRuntime
.
queryInterface
(
XLoadable
.
class
,
m_detailForm
);
XLoadable
loadDetail
=
UnoRuntime
.
queryInterface
(
XLoadable
.
class
,
m_detailForm
);
loadDetail
.
addLoadListener
(
this
);
subDocument
.
getCurrentView
().
toggleFormDesignMode
();
...
...
@@ -314,10 +309,8 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
{
if
(
subComponentCommands
!=
null
)
{
XComponentSupplier
componentSupplier
=
(
XComponentSupplier
)
UnoRuntime
.
queryInterface
(
XComponentSupplier
.
class
,
subComponentCommands
);
XModifiable
modifySubComponent
=
(
XModifiable
)
UnoRuntime
.
queryInterface
(
XModifiable
.
class
,
componentSupplier
.
getComponent
()
);
XComponentSupplier
componentSupplier
=
UnoRuntime
.
queryInterface
(
XComponentSupplier
.
class
,
subComponentCommands
);
XModifiable
modifySubComponent
=
UnoRuntime
.
queryInterface
(
XModifiable
.
class
,
componentSupplier
.
getComponent
()
);
modifySubComponent
.
setModified
(
false
);
Command
command
=
new
Command
();
command
.
Name
=
"close"
;
...
...
@@ -349,8 +342,7 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
/* ------------------------------------------------------------------ */
private
XPropertySet
impl_createGridColumn
(
final
XIndexContainer
_gridModel
,
final
String
_columnType
,
final
String
_boundField
)
throws
Exception
{
final
XGridColumnFactory
columnFactory
=
(
XGridColumnFactory
)
UnoRuntime
.
queryInterface
(
XGridColumnFactory
.
class
,
_gridModel
);
final
XGridColumnFactory
columnFactory
=
UnoRuntime
.
queryInterface
(
XGridColumnFactory
.
class
,
_gridModel
);
XPropertySet
column
=
columnFactory
.
createColumn
(
_columnType
);
column
.
setPropertyValue
(
"DataField"
,
_boundField
);
column
.
setPropertyValue
(
"Name"
,
_boundField
);
...
...
@@ -399,8 +391,8 @@ public class MasterDetailForms extends complexlib.ComplexTestCase implements com
*/
private
void
verifyColumnValueIdentity
(
final
String
masterColName
,
final
String
detailColName
)
throws
SQLException
{
XColumnLocate
locateMasterCols
=
(
XColumnLocate
)
UnoRuntime
.
queryInterface
(
XColumnLocate
.
class
,
m_masterForm
);
XColumnLocate
locateDetailCols
=
(
XColumnLocate
)
UnoRuntime
.
queryInterface
(
XColumnLocate
.
class
,
m_detailForm
);
XColumnLocate
locateMasterCols
=
UnoRuntime
.
queryInterface
(
XColumnLocate
.
class
,
m_masterForm
);
XColumnLocate
locateDetailCols
=
UnoRuntime
.
queryInterface
(
XColumnLocate
.
class
,
m_detailForm
);
int
masterValue
=
m_masterResult
.
getInt
(
locateMasterCols
.
findColumn
(
masterColName
)
);
int
detailValue
=
m_detailResult
.
getInt
(
locateDetailCols
.
findColumn
(
detailColName
)
);
...
...
forms/qa/integration/forms/TestCase.java
Dosyayı görüntüle @
cc0a4e48
...
...
@@ -30,11 +30,9 @@
package
integration
.
forms
;
import
com.sun.star.uno.*
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.util.XCloseable
;
import
com.sun.star.util.XModifiable
;
import
integration.forms.DocumentType
;
public
abstract
class
TestCase
extends
complexlib
.
ComplexTestCase
implements
com
.
sun
.
star
.
lang
.
XEventListener
{
...
...
@@ -49,12 +47,23 @@ public abstract class TestCase extends complexlib.ComplexTestCase implements com
m_documentType
=
docType
;
}
/* ------------------------------------------------------------------ */
public
String
getTestObjectName
()
{
return
this
.
getClass
().
getName
();
}
/* ------------------------------------------------------------------ */
public
void
before
()
throws
com
.
sun
.
star
.
uno
.
Exception
,
java
.
lang
.
Exception
{
m_orb
=
(
XMultiServiceFactory
)
param
.
getMSF
();
}
/* ------------------------------------------------------------------ */
public
void
after
()
throws
com
.
sun
.
star
.
uno
.
Exception
,
java
.
lang
.
Exception
{
}
/* ------------------------------------------------------------------ */
/** closes our document, if we have an open one, via (simulated) user input
*/
...
...
forms/qa/integration/forms/dbfTools.java
Dosyayı görüntüle @
cc0a4e48
...
...
@@ -24,7 +24,7 @@ class dbfTools
*/
static
public
XPropertySet
queryPropertySet
(
Object
aComp
)
{
return
(
XPropertySet
)
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
aComp
);
return
UnoRuntime
.
queryInterface
(
XPropertySet
.
class
,
aComp
);
}
/* ------------------------------------------------------------------ */
...
...
@@ -32,7 +32,7 @@ class dbfTools
*/
static
public
XIndexContainer
queryIndexContainer
(
Object
aComp
)
{
return
(
XIndexContainer
)
UnoRuntime
.
queryInterface
(
XIndexContainer
.
class
,
aComp
);
return
UnoRuntime
.
queryInterface
(
XIndexContainer
.
class
,
aComp
);
}
/* ------------------------------------------------------------------ */
...
...
@@ -40,15 +40,16 @@ class dbfTools
*/
static
public
XComponent
queryComponent
(
Object
aComp
)
{
return
(
XComponent
)
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
aComp
);
return
UnoRuntime
.
queryInterface
(
XComponent
.
class
,
aComp
);
}
/* ------------------------------------------------------------------ */
/** retrieves the parent of the given object
*/
@SuppressWarnings
(
"unchecked"
)
static
Object
getParent
(
Object
aComponent
,
Class
aInterfaceClass
)
{
XChild
xAsChild
=
(
XChild
)
UnoRuntime
.
queryInterface
(
XChild
.
class
,
aComponent
);
XChild
xAsChild
=
UnoRuntime
.
queryInterface
(
XChild
.
class
,
aComponent
);
return
UnoRuntime
.
queryInterface
(
aInterfaceClass
,
xAsChild
.
getParent
()
);
}
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment