* This tests the XMultiPropertySet interface implementation.
*/
public void checkXMultiPropertySet()
{
log.println("---- Testing the XMultiPropertySet interface ----");
XMultiPropertySet xMPS = (XMultiPropertySet)
UnoRuntime.queryInterface(XMultiPropertySet.class, oObj);
String[] correctVals = new String[props.length];
String[] incorrectVals = new String[props.length];
// get intitial values and create new ones
for (int i = 0; i < props.length; i++) {
correctVals[i] = changeToCorrectValue(propVals[i]);
incorrectVals[i] = changeToIncorrectValue(propVals[i]);
}
try {
// add a change listener
MyChangeListener mListener = new MyChangeListener();
xMPS.addPropertiesChangeListener(propNames, mListener);
// first change props to correct values
log.println("Change to correct values.");
xMPS.setPropertyValues(propNames, correctVals);
assure("Could not change to correct values with XMultiPropoertySet.",
verifyPropertySet(xMPS,propNames,correctVals)>0);
// second, change to incorrect values: expect an exception
log.println("Try to change to incorrect values.");
try {
xMPS.setPropertyValues(propNames, incorrectVals);
}
catch(com.sun.star.lang.IllegalArgumentException r) {
log.println("Correctly thrown Exception caught.");
}
assure("Did change to incorrect values with XMultiPropertySet," +
" but should not have.",
verifyPropertySet(xMPS,propNames,correctVals)>0);
// third, change back to initial values
log.println("Change back to initial values.");
xMPS.setPropertyValues(propNames, propVals);
assure("Could not change back to initial values with" +
" XMultiPropertySet.",
verifyPropertySet(xMPS,propNames,propVals)>0);
// fire the event for the listener
log.println("Fire event.");
xMPS.firePropertiesChangeEvent(propNames, mListener);
assure("Event was not fired on XMultiPropertySet.",
mListener.changePropertiesEventFired());
}
catch(com.sun.star.uno.Exception e) {
// e.printStackTrace();