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
9ac5ecbe
Kaydet (Commit)
9ac5ecbe
authored
Eyl 08, 2003
tarafından
Rüdiger Timm
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
INTEGRATION: CWS qadev11 (1.2.14); FILE MERGED
2003/09/03 15:33:11 sw 1.2.14.1: #112049#
üst
45020445
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
283 additions
and
222 deletions
+283
-222
ORadioButtonModel.java
qadevOOo/tests/java/mod/_forms/ORadioButtonModel.java
+105
-81
OTimeControl.java
qadevOOo/tests/java/mod/_forms/OTimeControl.java
+69
-55
OTimeModel.java
qadevOOo/tests/java/mod/_forms/OTimeModel.java
+109
-86
No files found.
qadevOOo/tests/java/mod/_forms/ORadioButtonModel.java
Dosyayı görüntüle @
9ac5ecbe
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: ORadioButtonModel.java,v $
* $RCSfile: ORadioButtonModel.java,v $
*
*
* $Revision: 1.
2
$
* $Revision: 1.
3
$
*
*
* last change:$Date: 2003-0
5-27 12:45:59
$
* last change:$Date: 2003-0
9-08 11:51:22
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -58,28 +58,29 @@
...
@@ -58,28 +58,29 @@
*
*
*
*
************************************************************************/
************************************************************************/
package
mod
.
_forms
;
package
mod
.
_forms
;
import
java.io.PrintWriter
;
import
lib.StatusException
;
import
lib.TestCase
;
import
lib.TestEnvironment
;
import
lib.TestParameters
;
import
util.DBTools
;
import
util.FormTools
;
import
util.WriterTools
;
import
com.sun.star.beans.XPropertySet
;
import
com.sun.star.beans.XPropertySet
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.drawing.XControlShape
;
import
com.sun.star.drawing.XControlShape
;
import
com.sun.star.drawing.XShape
;
import
com.sun.star.drawing.XShape
;
import
com.sun.star.form.XBoundComponent
;
import
com.sun.star.form.XBoundComponent
;
import
com.sun.star.form.XLoadable
;
import
com.sun.star.form.XLoadable
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.sdbc.XResultSetUpdate
;
import
com.sun.star.sdbc.XResultSetUpdate
;
import
com.sun.star.text.XTextDocument
;
import
com.sun.star.text.XTextDocument
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XInterface
;
import
java.io.PrintWriter
;
import
com.sun.star.util.XCloseable
;
import
lib.StatusException
;
import
lib.TestCase
;
import
lib.TestEnvironment
;
import
lib.TestParameters
;
import
util.DBTools
;
import
util.FormTools
;
import
util.SOfficeFactory
;
import
util.WriterTools
;
/**
/**
...
@@ -147,23 +148,31 @@ import util.WriterTools;
...
@@ -147,23 +148,31 @@ import util.WriterTools;
* @see ifc.container._XChild
* @see ifc.container._XChild
*/
*/
public
class
ORadioButtonModel
extends
TestCase
{
public
class
ORadioButtonModel
extends
TestCase
{
XTextDocument
xTextDoc
;
XTextDocument
xTextDoc
;
/**
/**
* Creates Writer document where controls are placed.
* Creates Writer document where controls are placed.
*/
*/
protected
void
initialize
(
TestParameters
tParam
,
PrintWriter
log
)
{
protected
void
initialize
(
TestParameters
tParam
,
PrintWriter
log
)
{
log
.
println
(
"creating a text document"
);
log
.
println
(
"creating a text document"
);
xTextDoc
=
WriterTools
.
createTextDoc
((
XMultiServiceFactory
)
tParam
.
getMSF
(
));
xTextDoc
=
WriterTools
.
createTextDoc
((
(
XMultiServiceFactory
)
tParam
.
getMSF
()
));
}
}
/**
/**
* Disposes Writer document.
* Disposes Writer document.
*/
*/
protected
void
cleanup
(
TestParameters
tParam
,
PrintWriter
log
)
{
protected
void
cleanup
(
TestParameters
tParam
,
PrintWriter
log
)
{
log
.
println
(
" disposing xDrawDoc "
);
log
.
println
(
" disposing xTextDoc "
);
xTextDoc
.
dispose
();
try
{
XCloseable
closer
=
(
XCloseable
)
UnoRuntime
.
queryInterface
(
XCloseable
.
class
,
xTextDoc
);
closer
.
close
(
true
);
}
catch
(
com
.
sun
.
star
.
util
.
CloseVetoException
e
)
{
log
.
println
(
"couldn't close document"
);
}
catch
(
com
.
sun
.
star
.
lang
.
DisposedException
e
)
{
log
.
println
(
"couldn't close document"
);
}
}
}
/**
/**
...
@@ -194,109 +203,124 @@ public class ORadioButtonModel extends TestCase {
...
@@ -194,109 +203,124 @@ public class ORadioButtonModel extends TestCase {
* </ul>
* </ul>
* @see ifc.form._XUpdateBroadcaster
* @see ifc.form._XUpdateBroadcaster
*/
*/
protected
synchronized
TestEnvironment
createTestEnvironment
(
TestParameters
Param
,
PrintWriter
log
)
{
protected
synchronized
TestEnvironment
createTestEnvironment
(
TestParameters
Param
,
PrintWriter
log
)
{
XInterface
oObj
=
null
;
XInterface
oObj
=
null
;
// creation of testobject here
// creation of testobject here
// first we write what we are intend to do to log file
// first we write what we are intend to do to log file
log
.
println
(
"creating a test environment"
);
log
.
println
(
"creating a test environment"
);
// get a soffice factory object
SOfficeFactory
SOF
=
SOfficeFactory
.
getFactory
(
(
XMultiServiceFactory
)
Param
.
getMSF
());
//get RadioButtonModel
//get RadioButtonModel
String
objName
=
"RadioButton"
;
String
objName
=
"RadioButton"
;
XControlShape
aShape
=
FormTools
.
createControlShape
(
XControlShape
aShape
=
FormTools
.
createControlShape
(
xTextDoc
,
3000
,
xTextDoc
,
3000
,
4500
,
15000
,
10000
,
objName
);
4500
,
15000
,
10000
,
objName
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
oObj
=
aShape
.
getControl
();
oObj
=
aShape
.
getControl
();
XLoadable
formLoader
=
null
;
XLoadable
formLoader
=
null
;
try
{
try
{
DBTools
dbTools
=
new
DBTools
((
XMultiServiceFactory
)
Param
.
getMSF
())
;
DBTools
dbTools
=
new
DBTools
((
(
XMultiServiceFactory
)
Param
.
getMSF
()))
;
dbTools
.
registerTestDB
((
String
)
System
.
getProperty
(
"DOCPTH"
))
;
dbTools
.
registerTestDB
((
String
)
System
.
getProperty
(
"DOCPTH"
));
formLoader
=
FormTools
.
bindForm
(
xTextDoc
,
formLoader
=
FormTools
.
bindForm
(
xTextDoc
,
"APITestDatabase"
,
"APITestDatabase"
,
"TestDB"
);
"TestDB"
);
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
log
.
println
(
"!!! Can't access TestDB !!!"
)
;
log
.
println
(
"!!! Can't access TestDB !!!"
);
e
.
printStackTrace
(
log
)
;
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Can't access TestDB"
,
e
)
;
throw
new
StatusException
(
"Can't access TestDB"
,
e
);
}
}
final
XPropertySet
ps
=
(
XPropertySet
)
UnoRuntime
.
queryInterface
final
XPropertySet
ps
=
(
XPropertySet
)
UnoRuntime
.
queryInterface
(
(
XPropertySet
.
class
,
oObj
);
XPropertySet
.
class
,
oObj
);
try
{
try
{
ps
.
setPropertyValue
(
"DataField"
,
DBTools
.
TST_STRING_F
)
;
ps
.
setPropertyValue
(
"DataField"
,
DBTools
.
TST_STRING_F
);
}
catch
(
com
.
sun
.
star
.
lang
.
WrappedTargetException
e
)
{
}
catch
(
com
.
sun
.
star
.
lang
.
WrappedTargetException
e
)
{
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
}
catch
(
com
.
sun
.
star
.
lang
.
IllegalArgumentException
e
)
{
}
catch
(
com
.
sun
.
star
.
lang
.
IllegalArgumentException
e
)
{
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
}
catch
(
com
.
sun
.
star
.
beans
.
PropertyVetoException
e
)
{
}
catch
(
com
.
sun
.
star
.
beans
.
PropertyVetoException
e
)
{
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
}
catch
(
com
.
sun
.
star
.
beans
.
UnknownPropertyException
e
)
{
}
catch
(
com
.
sun
.
star
.
beans
.
UnknownPropertyException
e
)
{
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
}
}
aShape
=
FormTools
.
createControlShape
(
aShape
=
FormTools
.
createControlShape
(
xTextDoc
,
6000
,
4500
,
15000
,
xTextDoc
,
6000
,
4500
,
15000
,
10000
,
"GroupBox"
);
10000
,
"GroupBox"
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
log
.
println
(
"creating a new environment for drawpage object"
);
log
.
println
(
"creating a new environment for drawpage object"
);
TestEnvironment
tEnv
=
new
TestEnvironment
(
oObj
);
TestEnvironment
tEnv
=
new
TestEnvironment
(
oObj
);
tEnv
.
addObjRelation
(
"OBJNAME"
,
"stardiv.one.form.component."
+
objName
);
tEnv
.
addObjRelation
(
"OBJNAME"
,
"stardiv.one.form.component."
+
objName
);
// added LabelControl for 'DataAwareControlModel'
// added LabelControl for 'DataAwareControlModel'
tEnv
.
addObjRelation
(
"LC"
,
aShape
.
getControl
());
tEnv
.
addObjRelation
(
"LC"
,
aShape
.
getControl
());
//adding ObjRelation for XPersistObject
//adding ObjRelation for XPersistObject
tEnv
.
addObjRelation
(
"PSEUDOPERSISTENT"
,
new
Boolean
(
true
));
tEnv
.
addObjRelation
(
"PSEUDOPERSISTENT"
,
new
Boolean
(
true
));
// added FormLoader for 'DataAwareControlModel'
// added FormLoader for 'DataAwareControlModel'
tEnv
.
addObjRelation
(
"FL"
,
formLoader
);
tEnv
.
addObjRelation
(
"FL"
,
formLoader
);
tEnv
.
addObjRelation
(
"DataAwareControlModel.NewFieldName"
,
tEnv
.
addObjRelation
(
"DataAwareControlModel.NewFieldName"
,
DBTools
.
TST_INT_F
)
;
DBTools
.
TST_INT_F
)
;
// adding relation for XUpdateBroadcaster
// adding relation for XUpdateBroadcaster
final
XInterface
ctrl
=
oObj
;
final
XInterface
ctrl
=
oObj
;
final
XLoadable
formLoaderF
=
formLoader
;
final
XLoadable
formLoaderF
=
formLoader
;
tEnv
.
addObjRelation
(
"XUpdateBroadcaster.Checker"
,
tEnv
.
addObjRelation
(
"XUpdateBroadcaster.Checker"
,
new
ifc
.
form
.
_XUpdateBroadcaster
.
UpdateChecker
()
{
new
ifc
.
form
.
_XUpdateBroadcaster
.
UpdateChecker
()
{
private
short
lastVal
=
0
;
private
short
lastVal
=
0
;
public
void
update
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
if
(!
formLoaderF
.
isLoaded
())
public
void
update
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
formLoaderF
.
load
()
;
if
(!
formLoaderF
.
isLoaded
())
{
lastVal
=
(
short
)
(
1
-
lastVal
)
;
formLoaderF
.
load
();
ps
.
setPropertyValue
(
"State"
,
new
Short
(
lastVal
))
;
}
public
void
commit
()
throws
com
.
sun
.
star
.
sdbc
.
SQLException
{
XBoundComponent
bound
=
(
XBoundComponent
)
UnoRuntime
.
queryInterface
(
XBoundComponent
.
class
,
ctrl
)
;
XResultSetUpdate
update
=
(
XResultSetUpdate
)
UnoRuntime
.
queryInterface
(
XResultSetUpdate
.
class
,
formLoaderF
)
;
// XBoundComponent is optional here
if
(
bound
!=
null
)
bound
.
commit
()
;
update
.
updateRow
()
;
}
}
public
boolean
wasCommited
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
formLoaderF
.
reload
()
;
Short
getS
=
(
Short
)
ps
.
getPropertyValue
(
"State"
)
;
lastVal
=
(
short
)
(
1
-
lastVal
);
return
getS
!=
null
&&
lastVal
==
getS
.
shortValue
()
;
ps
.
setPropertyValue
(
"State"
,
new
Short
(
lastVal
));
}
public
void
commit
()
throws
com
.
sun
.
star
.
sdbc
.
SQLException
{
XBoundComponent
bound
=
(
XBoundComponent
)
UnoRuntime
.
queryInterface
(
XBoundComponent
.
class
,
ctrl
);
XResultSetUpdate
update
=
(
XResultSetUpdate
)
UnoRuntime
.
queryInterface
(
XResultSetUpdate
.
class
,
formLoaderF
);
// XBoundComponent is optional here
if
(
bound
!=
null
)
{
bound
.
commit
();
}
}
})
;
return
tEnv
;
update
.
updateRow
();
}
// finish method getTestEnvironment
}
public
boolean
wasCommited
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
formLoaderF
.
reload
();
Short
getS
=
(
Short
)
ps
.
getPropertyValue
(
"State"
);
}
// finish class ORadioButtonModel
return
(
getS
!=
null
)
&&
(
lastVal
==
getS
.
shortValue
());
}
});
return
tEnv
;
}
// finish method getTestEnvironment
}
// finish class ORadioButtonModel
qadevOOo/tests/java/mod/_forms/OTimeControl.java
Dosyayı görüntüle @
9ac5ecbe
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: OTimeControl.java,v $
* $RCSfile: OTimeControl.java,v $
*
*
* $Revision: 1.
2
$
* $Revision: 1.
3
$
*
*
* last change:$Date: 2003-0
5-27 12:46:11
$
* last change:$Date: 2003-0
9-08 11:51:33
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -58,11 +58,19 @@
...
@@ -58,11 +58,19 @@
*
*
*
*
************************************************************************/
************************************************************************/
package
mod
.
_forms
;
package
mod
.
_forms
;
import
java.io.PrintWriter
;
import
lib.StatusException
;
import
lib.TestCase
;
import
lib.TestEnvironment
;
import
lib.TestParameters
;
import
util.FormTools
;
import
util.SOfficeFactory
;
import
util.WriterTools
;
import
com.sun.star.awt.XControl
;
import
com.sun.star.awt.XControl
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.awt.XControlModel
;
import
com.sun.star.awt.XControlModel
;
import
com.sun.star.awt.XDevice
;
import
com.sun.star.awt.XDevice
;
import
com.sun.star.awt.XGraphics
;
import
com.sun.star.awt.XGraphics
;
...
@@ -72,18 +80,13 @@ import com.sun.star.awt.XWindow;
...
@@ -72,18 +80,13 @@ import com.sun.star.awt.XWindow;
import
com.sun.star.awt.XWindowPeer
;
import
com.sun.star.awt.XWindowPeer
;
import
com.sun.star.drawing.XControlShape
;
import
com.sun.star.drawing.XControlShape
;
import
com.sun.star.drawing.XShape
;
import
com.sun.star.drawing.XShape
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.text.XTextDocument
;
import
com.sun.star.text.XTextDocument
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.util.XCloseable
;
import
com.sun.star.view.XControlAccess
;
import
com.sun.star.view.XControlAccess
;
import
java.io.PrintWriter
;
import
lib.StatusException
;
import
lib.TestCase
;
import
lib.TestEnvironment
;
import
lib.TestParameters
;
import
util.FormTools
;
import
util.SOfficeFactory
;
import
util.WriterTools
;
/**
/**
* Test for object which is represented by default controller
* Test for object which is represented by default controller
...
@@ -131,31 +134,39 @@ import util.WriterTools;
...
@@ -131,31 +134,39 @@ import util.WriterTools;
* @see ifc.lang._XEventListener
* @see ifc.lang._XEventListener
*/
*/
public
class
OTimeControl
extends
TestCase
{
public
class
OTimeControl
extends
TestCase
{
XTextDocument
xTextDoc
;
XTextDocument
xTextDoc
;
/**
/**
* Creates a new text document.
* Creates a new text document.
*/
*/
protected
void
initialize
(
TestParameters
Param
,
PrintWriter
log
)
{
protected
void
initialize
(
TestParameters
Param
,
PrintWriter
log
)
{
SOfficeFactory
SOF
=
SOfficeFactory
.
getFactory
(
(
XMultiServiceFactory
)
Param
.
getMSF
()
);
SOfficeFactory
SOF
=
SOfficeFactory
.
getFactory
(
((
XMultiServiceFactory
)
Param
.
getMSF
())
);
try
{
try
{
log
.
println
(
"creating a textdocument"
);
log
.
println
(
"creating a textdocument"
);
xTextDoc
=
SOF
.
createTextDoc
(
null
);
xTextDoc
=
SOF
.
createTextDoc
(
null
);
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
// Some exception occures.FAILED
// Some exception occures.FAILED
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't create document"
,
e
);
throw
new
StatusException
(
"Couldn't create document"
,
e
);
}
}
}
}
/**
/**
* Disposes the text document created before
* Disposes the text document created before
*/
*/
protected
void
cleanup
(
TestParameters
tParam
,
PrintWriter
log
)
{
protected
void
cleanup
(
TestParameters
tParam
,
PrintWriter
log
)
{
log
.
println
(
" disposing xTextDoc "
);
log
.
println
(
" disposing xTextDoc "
);
xTextDoc
.
dispose
();
try
{
XCloseable
closer
=
(
XCloseable
)
UnoRuntime
.
queryInterface
(
XCloseable
.
class
,
xTextDoc
);
closer
.
close
(
true
);
}
catch
(
com
.
sun
.
star
.
util
.
CloseVetoException
e
)
{
log
.
println
(
"couldn't close document"
);
}
catch
(
com
.
sun
.
star
.
lang
.
DisposedException
e
)
{
log
.
println
(
"couldn't close document"
);
}
}
}
/**
/**
...
@@ -187,25 +198,27 @@ public class OTimeControl extends TestCase {
...
@@ -187,25 +198,27 @@ public class OTimeControl extends TestCase {
* component. </li>
* component. </li>
* </ul>
* </ul>
*/
*/
public
TestEnvironment
createTestEnvironment
(
TestParameters
Param
,
protected
TestEnvironment
createTestEnvironment
(
TestParameters
Param
,
PrintWriter
log
)
PrintWriter
log
)
{
throws
StatusException
{
XInterface
oObj
=
null
;
XInterface
oObj
=
null
;
XWindowPeer
the_win
=
null
;
XWindowPeer
the_win
=
null
;
XToolkit
the_kit
=
null
;
XToolkit
the_kit
=
null
;
XDevice
aDevice
=
null
;
XDevice
aDevice
=
null
;
XGraphics
aGraphic
=
null
;
XGraphics
aGraphic
=
null
;
XControl
aControl
=
null
;
XControl
aControl
=
null
;
//Insert a ControlShape and get the ControlModel
//Insert a ControlShape and get the ControlModel
XControlShape
aShape
=
FormTools
.
createControlShape
(
XControlShape
aShape
=
FormTools
.
createControlShape
(
xTextDoc
,
3000
,
xTextDoc
,
3000
,
4500
,
15000
,
10000
,
"TimeField"
);
4500
,
15000
,
10000
,
"TimeField"
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
XControlModel
the_Model
=
aShape
.
getControl
();
XControlModel
the_Model
=
aShape
.
getControl
();
XControlShape
aShape2
=
FormTools
.
createControlShape
(
XControlShape
aShape2
=
FormTools
.
createControlShape
(
xTextDoc
,
3000
,
xTextDoc
,
3000
,
4500
,
5000
,
10000
,
"TextField"
);
4500
,
5000
,
10000
,
"TextField"
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape2
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape2
);
...
@@ -213,7 +226,8 @@ public class OTimeControl extends TestCase {
...
@@ -213,7 +226,8 @@ public class OTimeControl extends TestCase {
//Try to query XControlAccess
//Try to query XControlAccess
XControlAccess
the_access
=
(
XControlAccess
)
UnoRuntime
.
queryInterface
(
XControlAccess
the_access
=
(
XControlAccess
)
UnoRuntime
.
queryInterface
(
XControlAccess
.
class
,
xTextDoc
.
getCurrentController
());
XControlAccess
.
class
,
xTextDoc
.
getCurrentController
());
//now get the OTimeControl
//now get the OTimeControl
try
{
try
{
...
@@ -221,42 +235,46 @@ public class OTimeControl extends TestCase {
...
@@ -221,42 +235,46 @@ public class OTimeControl extends TestCase {
aControl
=
the_access
.
getControl
(
the_Model2
);
aControl
=
the_access
.
getControl
(
the_Model2
);
the_win
=
the_access
.
getControl
(
the_Model
).
getPeer
();
the_win
=
the_access
.
getControl
(
the_Model
).
getPeer
();
the_kit
=
the_win
.
getToolkit
();
the_kit
=
the_win
.
getToolkit
();
aDevice
=
the_kit
.
createScreenCompatibleDevice
(
200
,
200
);
aDevice
=
the_kit
.
createScreenCompatibleDevice
(
200
,
200
);
aGraphic
=
aDevice
.
createGraphics
();
aGraphic
=
aDevice
.
createGraphics
();
}
catch
(
com
.
sun
.
star
.
container
.
NoSuchElementException
e
)
{
}
catch
(
com
.
sun
.
star
.
container
.
NoSuchElementException
e
)
{
log
.
println
(
"Couldn't get OTimeControl"
);
log
.
println
(
"Couldn't get OTimeControl"
);
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't get OTimeControl"
,
e
);
throw
new
StatusException
(
"Couldn't get OTimeControl"
,
e
);
}
}
log
.
println
(
"creating a new environment for OTimeControl object"
);
log
.
println
(
"creating a new environment for OTimeControl object"
);
TestEnvironment
tEnv
=
new
TestEnvironment
(
oObj
);
TestEnvironment
tEnv
=
new
TestEnvironment
(
oObj
);
//Adding ObjRelation for XView
//Adding ObjRelation for XView
tEnv
.
addObjRelation
(
"GRAPHICS"
,
aGraphic
);
tEnv
.
addObjRelation
(
"GRAPHICS"
,
aGraphic
);
//Adding ObjRelation for XControl
//Adding ObjRelation for XControl
tEnv
.
addObjRelation
(
"CONTEXT"
,
xTextDoc
);
tEnv
.
addObjRelation
(
"CONTEXT"
,
xTextDoc
);
tEnv
.
addObjRelation
(
"WINPEER"
,
the_win
);
tEnv
.
addObjRelation
(
"WINPEER"
,
the_win
);
tEnv
.
addObjRelation
(
"TOOLKIT"
,
the_kit
);
tEnv
.
addObjRelation
(
"TOOLKIT"
,
the_kit
);
tEnv
.
addObjRelation
(
"MODEL"
,
the_Model
);
tEnv
.
addObjRelation
(
"MODEL"
,
the_Model
);
XWindow
forObjRel
=
(
XWindow
)
XWindow
forObjRel
=
(
XWindow
)
UnoRuntime
.
queryInterface
(
XWindow
.
class
,
UnoRuntime
.
queryInterface
(
XWindow
.
class
,
aControl
);
aControl
);
tEnv
.
addObjRelation
(
"XWindow.AnotherWindow"
,
forObjRel
);
tEnv
.
addObjRelation
(
"XWindow.AnotherWindow"
,
forObjRel
);
tEnv
.
addObjRelation
(
"XWindow.ControlShape"
,
aShape
);
tEnv
.
addObjRelation
(
"XWindow.ControlShape"
,
aShape
);
// Adding relation for XTextListener
// Adding relation for XTextListener
ifc
.
awt
.
_XTextListener
.
TestTextListener
listener
=
ifc
.
awt
.
_XTextListener
.
TestTextListener
listener
=
new
ifc
.
awt
.
_XTextListener
.
TestTextListener
()
;
new
ifc
.
awt
.
_XTextListener
.
TestTextListener
()
;
XTextComponent
textComp
=
(
XTextComponent
)
XTextComponent
textComp
=
(
XTextComponent
)
UnoRuntime
.
queryInterface
(
UnoRuntime
.
queryInterface
(
XTextComponent
.
class
,
oObj
);
XTextComponent
.
class
,
oObj
);
textComp
.
addTextListener
(
listener
);
textComp
.
addTextListener
(
listener
);
tEnv
.
addObjRelation
(
"TestTextListener"
,
listener
);
tEnv
.
addObjRelation
(
"TestTextListener"
,
listener
);
FormTools
.
switchDesignOf
((
XMultiServiceFactory
)
Param
.
getMSF
(),
xTextDoc
);
FormTools
.
switchDesignOf
((
(
XMultiServiceFactory
)
Param
.
getMSF
()),
xTextDoc
);
shortWait
();
shortWait
();
return
tEnv
;
return
tEnv
;
}
// finish method getTestEnvironment
}
// finish method getTestEnvironment
...
@@ -266,13 +284,9 @@ public class OTimeControl extends TestCase {
...
@@ -266,13 +284,9 @@ public class OTimeControl extends TestCase {
*/
*/
private
void
shortWait
()
{
private
void
shortWait
()
{
try
{
try
{
Thread
.
sleep
(
200
)
;
Thread
.
sleep
(
200
);
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
System
.
out
.
println
(
"While waiting :"
+
e
)
;
System
.
out
.
println
(
"While waiting :"
+
e
);
}
}
}
}
}
// finish class OTimeControl
}
// finish class OTimeControl
qadevOOo/tests/java/mod/_forms/OTimeModel.java
Dosyayı görüntüle @
9ac5ecbe
...
@@ -2,9 +2,9 @@
...
@@ -2,9 +2,9 @@
*
*
* $RCSfile: OTimeModel.java,v $
* $RCSfile: OTimeModel.java,v $
*
*
* $Revision: 1.
2
$
* $Revision: 1.
3
$
*
*
* last change:$Date: 2003-0
5-27 12:46:22
$
* last change:$Date: 2003-0
9-08 11:51:45
$
*
*
* The Contents of this file are made available subject to the terms of
* The Contents of this file are made available subject to the terms of
* either of the following licenses
* either of the following licenses
...
@@ -58,27 +58,30 @@
...
@@ -58,27 +58,30 @@
*
*
*
*
************************************************************************/
************************************************************************/
package
mod
.
_forms
;
package
mod
.
_forms
;
import
java.io.PrintWriter
;
import
lib.StatusException
;
import
lib.TestCase
;
import
lib.TestEnvironment
;
import
lib.TestParameters
;
import
util.DBTools
;
import
util.FormTools
;
import
util.WriterTools
;
import
com.sun.star.beans.XPropertySet
;
import
com.sun.star.beans.XPropertySet
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.drawing.XControlShape
;
import
com.sun.star.drawing.XControlShape
;
import
com.sun.star.drawing.XShape
;
import
com.sun.star.drawing.XShape
;
import
com.sun.star.form.XBoundComponent
;
import
com.sun.star.form.XBoundComponent
;
import
com.sun.star.form.XLoadable
;
import
com.sun.star.form.XLoadable
;
import
com.sun.star.lang.XMultiServiceFactory
;
import
com.sun.star.sdbc.XResultSetUpdate
;
import
com.sun.star.sdbc.XResultSetUpdate
;
import
com.sun.star.text.XTextDocument
;
import
com.sun.star.text.XTextDocument
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.UnoRuntime
;
import
com.sun.star.uno.XInterface
;
import
com.sun.star.uno.XInterface
;
import
java.io.PrintWriter
;
import
com.sun.star.util.XCloseable
;
import
lib.StatusException
;
import
lib.TestCase
;
import
lib.TestEnvironment
;
import
lib.TestParameters
;
import
util.DBTools
;
import
util.FormTools
;
import
util.WriterTools
;
/**
/**
* Test for object which is represented by service
* Test for object which is represented by service
...
@@ -150,26 +153,32 @@ import util.WriterTools;
...
@@ -150,26 +153,32 @@ import util.WriterTools;
* @see ifc.container._XChild
* @see ifc.container._XChild
*/
*/
public
class
OTimeModel
extends
TestCase
{
public
class
OTimeModel
extends
TestCase
{
XTextDocument
xTextDoc
;
XTextDocument
xTextDoc
;
/**
/**
* Creates Writer document where controls are placed.
* Creates Writer document where controls are placed.
*/
*/
protected
void
initialize
(
TestParameters
tParam
,
PrintWriter
log
)
{
protected
void
initialize
(
TestParameters
tParam
,
PrintWriter
log
)
{
log
.
println
(
"creating a textdocument"
);
log
.
println
(
"creating a textdocument"
);
xTextDoc
=
WriterTools
.
createTextDoc
(((
XMultiServiceFactory
)
tParam
.
getMSF
()));
xTextDoc
=
WriterTools
.
createTextDoc
((
XMultiServiceFactory
)
tParam
.
getMSF
());
}
}
/**
/**
* Disposes Writer document.
* Disposes Writer document.
*/
*/
protected
void
cleanup
(
TestParameters
tParam
,
PrintWriter
log
)
{
protected
void
cleanup
(
TestParameters
tParam
,
PrintWriter
log
)
{
log
.
println
(
" disposing xTextDoc "
);
log
.
println
(
" disposing xTextDoc "
);
xTextDoc
.
dispose
();
}
try
{
XCloseable
closer
=
(
XCloseable
)
UnoRuntime
.
queryInterface
(
XCloseable
.
class
,
xTextDoc
);
closer
.
close
(
true
);
}
catch
(
com
.
sun
.
star
.
util
.
CloseVetoException
e
)
{
log
.
println
(
"couldn't close document"
);
}
catch
(
com
.
sun
.
star
.
lang
.
DisposedException
e
)
{
log
.
println
(
"couldn't close document"
);
}
}
/**
/**
* Creating a Testenvironment for the interfaces to be tested.
* Creating a Testenvironment for the interfaces to be tested.
...
@@ -203,111 +212,125 @@ public class OTimeModel extends TestCase {
...
@@ -203,111 +212,125 @@ public class OTimeModel extends TestCase {
* </ul>
* </ul>
* @see ifc.form._XUpdateBroadcaster
* @see ifc.form._XUpdateBroadcaster
*/
*/
public
synchronized
TestEnvironment
createTestEnvironment
(
TestParameters
Param
,
protected
synchronized
TestEnvironment
createTestEnvironment
(
TestParameters
Param
,
PrintWriter
log
)
PrintWriter
log
)
{
throws
StatusException
{
XInterface
oObj
=
null
;
XInterface
oObj
=
null
;
XControlShape
aShape
=
FormTools
.
createControlShape
(
XControlShape
aShape
=
FormTools
.
createControlShape
(
xTextDoc
,
3000
,
xTextDoc
,
3000
,
4500
,
15000
,
10000
,
"TimeField"
);
4500
,
15000
,
10000
,
"TimeField"
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
oObj
=
aShape
.
getControl
();
oObj
=
aShape
.
getControl
();
XLoadable
formLoader
=
null
;
XLoadable
formLoader
=
null
;
try
{
try
{
DBTools
dbTools
=
new
DBTools
((
XMultiServiceFactory
)
Param
.
getMSF
())
;
DBTools
dbTools
=
new
DBTools
((
(
XMultiServiceFactory
)
Param
.
getMSF
()))
;
dbTools
.
registerTestDB
((
String
)
System
.
getProperty
(
"DOCPTH"
))
;
dbTools
.
registerTestDB
((
String
)
System
.
getProperty
(
"DOCPTH"
));
formLoader
=
FormTools
.
bindForm
(
xTextDoc
,
formLoader
=
FormTools
.
bindForm
(
xTextDoc
,
"APITestDatabase"
,
"APITestDatabase"
,
"TestDB"
);
"TestDB"
);
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
}
catch
(
com
.
sun
.
star
.
uno
.
Exception
e
)
{
log
.
println
(
"!!! Can't access TestDB !!!"
)
;
log
.
println
(
"!!! Can't access TestDB !!!"
);
e
.
printStackTrace
(
log
)
;
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Can't access TestDB"
,
e
)
;
throw
new
StatusException
(
"Can't access TestDB"
,
e
);
}
}
log
.
println
(
"creating a new environment for object"
);
log
.
println
(
"creating a new environment for object"
);
TestEnvironment
tEnv
=
new
TestEnvironment
(
oObj
);
TestEnvironment
tEnv
=
new
TestEnvironment
(
oObj
);
String
objName
=
"TimeField"
;
String
objName
=
"TimeField"
;
tEnv
.
addObjRelation
(
"OBJNAME"
,
"stardiv.one.form.component."
+
objName
);
tEnv
.
addObjRelation
(
"OBJNAME"
,
"stardiv.one.form.component."
+
aShape
=
FormTools
.
createControlShape
(
objName
);
xTextDoc
,
6000
,
4500
,
15000
,
10000
,
"FixedText"
);
aShape
=
FormTools
.
createControlShape
(
xTextDoc
,
6000
,
4500
,
15000
,
10000
,
"FixedText"
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
WriterTools
.
getDrawPage
(
xTextDoc
).
add
((
XShape
)
aShape
);
final
XPropertySet
ps
=
(
XPropertySet
)
UnoRuntime
.
queryInterface
final
XPropertySet
ps
=
(
XPropertySet
)
UnoRuntime
.
queryInterface
(
(
XPropertySet
.
class
,
oObj
);
XPropertySet
.
class
,
oObj
);
try
{
try
{
ps
.
setPropertyValue
(
"DataField"
,
DBTools
.
TST_INT_F
)
;
ps
.
setPropertyValue
(
"DataField"
,
DBTools
.
TST_INT_F
);
}
catch
(
com
.
sun
.
star
.
lang
.
WrappedTargetException
e
)
{
}
catch
(
com
.
sun
.
star
.
lang
.
WrappedTargetException
e
)
{
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
}
catch
(
com
.
sun
.
star
.
lang
.
IllegalArgumentException
e
)
{
}
catch
(
com
.
sun
.
star
.
lang
.
IllegalArgumentException
e
)
{
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
}
catch
(
com
.
sun
.
star
.
beans
.
PropertyVetoException
e
)
{
}
catch
(
com
.
sun
.
star
.
beans
.
PropertyVetoException
e
)
{
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
}
catch
(
com
.
sun
.
star
.
beans
.
UnknownPropertyException
e
)
{
}
catch
(
com
.
sun
.
star
.
beans
.
UnknownPropertyException
e
)
{
e
.
printStackTrace
(
log
);
e
.
printStackTrace
(
log
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
throw
new
StatusException
(
"Couldn't set Default Date"
,
e
);
}
}
// added LabelControl for 'DataAwareControlModel'
// added LabelControl for 'DataAwareControlModel'
tEnv
.
addObjRelation
(
"LC"
,
aShape
.
getControl
());
tEnv
.
addObjRelation
(
"LC"
,
aShape
.
getControl
());
// added FormLoader for 'DataAwareControlModel'
// added FormLoader for 'DataAwareControlModel'
tEnv
.
addObjRelation
(
"FL"
,
formLoader
);
tEnv
.
addObjRelation
(
"FL"
,
formLoader
);
// adding relation for XUpdateBroadcaster
// adding relation for XUpdateBroadcaster
final
XInterface
ctrl
=
oObj
;
final
XInterface
ctrl
=
oObj
;
final
XLoadable
formLoaderF
=
formLoader
;
final
XLoadable
formLoaderF
=
formLoader
;
tEnv
.
addObjRelation
(
"XUpdateBroadcaster.Checker"
,
tEnv
.
addObjRelation
(
"XUpdateBroadcaster.Checker"
,
new
ifc
.
form
.
_XUpdateBroadcaster
.
UpdateChecker
()
{
new
ifc
.
form
.
_XUpdateBroadcaster
.
UpdateChecker
()
{
private
int
lastTime
=
0
;
private
int
lastTime
=
0
;
public
void
update
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
if
(!
formLoaderF
.
isLoaded
())
{
public
void
update
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
formLoaderF
.
load
()
;
if
(!
formLoaderF
.
isLoaded
())
{
}
formLoaderF
.
load
();
Integer
time
=
(
Integer
)
ps
.
getPropertyValue
(
"Time"
)
;
if
(
time
!=
null
)
lastTime
=
time
.
intValue
()
+
150000
;
ps
.
setPropertyValue
(
"Time"
,
new
Integer
(
lastTime
))
;
}
public
void
commit
()
throws
com
.
sun
.
star
.
sdbc
.
SQLException
{
XBoundComponent
bound
=
(
XBoundComponent
)
UnoRuntime
.
queryInterface
(
XBoundComponent
.
class
,
ctrl
)
;
XResultSetUpdate
update
=
(
XResultSetUpdate
)
UnoRuntime
.
queryInterface
(
XResultSetUpdate
.
class
,
formLoaderF
)
;
bound
.
commit
()
;
update
.
updateRow
()
;
}
}
public
boolean
wasCommited
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
formLoaderF
.
reload
()
;
Integer
getT
=
(
Integer
)
ps
.
getPropertyValue
(
"Time"
)
;
Integer
time
=
(
Integer
)
ps
.
getPropertyValue
(
"Time"
);
return
getT
!=
null
&&
Math
.
abs
(
getT
.
intValue
()
-
lastTime
)
<
100
;
if
(
time
!=
null
)
{
lastTime
=
time
.
intValue
()
+
150000
;
}
}
})
;
ps
.
setPropertyValue
(
"Time"
,
new
Integer
(
lastTime
));
}
public
void
commit
()
throws
com
.
sun
.
star
.
sdbc
.
SQLException
{
XBoundComponent
bound
=
(
XBoundComponent
)
UnoRuntime
.
queryInterface
(
XBoundComponent
.
class
,
ctrl
);
XResultSetUpdate
update
=
(
XResultSetUpdate
)
UnoRuntime
.
queryInterface
(
XResultSetUpdate
.
class
,
formLoaderF
);
bound
.
commit
();
update
.
updateRow
();
}
public
boolean
wasCommited
()
throws
com
.
sun
.
star
.
uno
.
Exception
{
formLoaderF
.
reload
();
Integer
getT
=
(
Integer
)
ps
.
getPropertyValue
(
"Time"
);
return
(
getT
!=
null
)
&&
(
Math
.
abs
(
getT
.
intValue
()
-
lastTime
)
<
100
);
}
});
// adding relation for DataAwareControlModel service
// adding relation for DataAwareControlModel service
tEnv
.
addObjRelation
(
"DataAwareControlModel.NewFieldName"
,
tEnv
.
addObjRelation
(
"DataAwareControlModel.NewFieldName"
,
DBTools
.
TST_INT_F
)
;
DBTools
.
TST_INT_F
);
//adding ObjRelation for XPersistObject
//adding ObjRelation for XPersistObject
tEnv
.
addObjRelation
(
"PSEUDOPERSISTENT"
,
new
Boolean
(
true
));
tEnv
.
addObjRelation
(
"PSEUDOPERSISTENT"
,
new
Boolean
(
true
));
// adding relation for XFastPropertySet
// adding relation for XFastPropertySet
java
.
util
.
HashSet
exclude
=
new
java
.
util
.
HashSet
()
;
java
.
util
.
HashSet
exclude
=
new
java
.
util
.
HashSet
();
exclude
.
add
(
"FormatKey"
)
;
exclude
.
add
(
"FormatKey"
);
tEnv
.
addObjRelation
(
"XFastPropertySet.ExcludeProps"
,
exclude
);
tEnv
.
addObjRelation
(
"XFastPropertySet.ExcludeProps"
,
exclude
);
return
tEnv
;
return
tEnv
;
}
// finish method getTestEnvironment
}
// finish method getTestEnvironment
}
// finish class OTimeModel
}
// finish class OTimeModel
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