NamedValue nv1 = new NamedValue("WordCount", new Integer(23));
NamedValue nv2 = new NamedValue("WordCount", new Integer(23));
System.out.println("eq: " + nv1.equals(nv2)); // grrr, this is false...
*/
assertTrue("DocumentStatistics:WordCount", containsNV(ds,
new NamedValue("WordCount", new Integer(23))));
assertTrue("DocumentStatistics:PageCount", containsNV(ds,
new NamedValue("PageCount", new Integer(1))));
XPropertyContainer udpc = xDP.getUserDefinedProperties();
XPropertySet udps = UnoRuntime.queryInterface( XPropertySet.class, udpc );
assertTrue("UserDefined 1", "Dies ist ein wichtiger Hinweis"
.equals(udps.getPropertyValue("Hinweis")));
assertTrue("UserDefined 2", ("Kann Spuren von N"
+ new String(new byte[] { (byte) 0xc3, (byte) 0xbc }, "UTF-8")
+ "ssen enthalten")
.equals(udps.getPropertyValue("Warnung")));
System.out.println("...done");
System.out.println("Checking meta-data updates...");
String str;
DateTime dt = new DateTime();
Locale l = new Locale();
int i;
str = "me";
xDP.setAuthor(str);
assertTrue("setAuthor", str.equals(xDP.getAuthor()));
str = "the computa";
xDP.setGenerator(str);
assertTrue("setGenerator", str.equals(xDP.getGenerator()));
dt.Year = 2038;
dt.Month = 1;
dt.Day = 1;
xDP.setCreationDate(dt);
assertTrue("setCreationDate", dt.Year == xDP.getCreationDate().Year);
str = "El t'itulo";
xDP.setTitle(str);
assertTrue("setTitle", str.equals(xDP.getTitle()));
str = "Ein verkommenes Subjekt";
xDP.setSubject(str);
assertTrue("setSubject", str.equals(xDP.getSubject()));
str = "Este descripci'on no es importante";
xDP.setDescription(str);
assertTrue("setDescription", str.equals(xDP.getDescription()));
l.Language = "en";
l.Country = "GB";
xDP.setLanguage(l);
Locale l2 = xDP.getLanguage();
assertTrue("setLanguage Lang", l.Language.equals(l2.Language));
assertTrue("setLanguage Cty", l.Country.equals(l2.Country));
str = "myself";
xDP.setModifiedBy(str);
assertTrue("setModifiedBy", str.equals(xDP.getModifiedBy()));
dt.Year = 2042;
xDP.setModificationDate(dt);
assertTrue("setModificationDate",
dt.Year == xDP.getModificationDate().Year);
str = "i didnt do it";
xDP.setPrintedBy(str);
assertTrue("setPrintedBy", str.equals(xDP.getPrintedBy()));
dt.Year = 2024;
xDP.setPrintDate(dt);
assertTrue("setPrintDate", dt.Year == xDP.getPrintDate().Year);
str = "blah";
xDP.setTemplateName(str);
assertTrue("setTemplateName", str.equals(xDP.getTemplateName()));
str = "gopher://some-hole-in-the-ground/";
xDP.setTemplateURL(str);
assertTrue("setTemplateURL", str.equals(xDP.getTemplateURL()));
dt.Year = 2043;
xDP.setTemplateDate(dt);
assertTrue("setTemplateDate", dt.Year == xDP.getTemplateDate().Year);
str = "http://nowhere/";
xDP.setAutoloadURL(str);
assertTrue("setAutoloadURL", str.equals(xDP.getAutoloadURL()));
i = 3661; // this might not work (due to conversion via double...)
xDP.setAutoloadSecs(i);
// System.out.println("set: " + i + " get: " + xDP.getAutoloadSecs());
assertTrue("setAutoloadSecs", i == xDP.getAutoloadSecs());
str = "_blank";
xDP.setDefaultTarget(str);
assertTrue("setDefaultTarget", str.equals(xDP.getDefaultTarget()));
i = 42;
xDP.setEditingCycles((short) i);
assertTrue("setEditingCycles", i == xDP.getEditingCycles());
i = 84;
xDP.setEditingDuration(i);
assertTrue("setEditingDuration", i == xDP.getEditingDuration());
str = "";
String[] kws2 = new String[] {
"keywordly", "keywordlike", "keywordalicious" };
xDP.setKeywords(kws2);
kws = xDP.getKeywords();
assertTrue("setKeywords", fromArray(kws).containsAll(fromArray(kws2)));
NamedValue[] ds2 = new NamedValue[] {
new NamedValue("SyllableCount", new Integer(9)),
new NamedValue("FrameCount", new Integer(2)),
new NamedValue("SentenceCount", new Integer(7)) };
xDP.setDocumentStatistics(ds2);
ds = xDP.getDocumentStatistics();
assertTrue("setDocumentStatistics:SyllableCount", containsNV(ds,
new NamedValue("SyllableCount", new Integer(9))));
assertTrue("setDocumentStatistics:FrameCount", containsNV(ds,
new NamedValue("FrameCount", new Integer(2))));
assertTrue("setDocumentStatistics:SentenceCount", containsNV(ds,
new NamedValue("SentenceCount", new Integer(7))));
System.out.println("...done");
System.out.println("Checking user-defined meta-data updates...");