From: <dg...@su...> - 2009-01-12 00:59:39
|
Author: dgollub Date: Mon Jan 12 01:58:48 2009 New Revision: 5123 URL: http://www.opensync.org/changeset/5123 Log: Updated regression testcase for #1021 Assembling XMLFormat with osync_xmlformat_set_() interfaces doesn't set child links. This cause failing comparsing with osync_xmlformat_parse() assembled xmlformat documents. Modified: format-plugins/xmlformat/trunk/tests/check_xmlformat.c format-plugins/xmlformat/trunk/tests/data/compare/contact1.xml Modified: format-plugins/xmlformat/trunk/tests/check_xmlformat.c ============================================================================== --- format-plugins/xmlformat/trunk/tests/check_xmlformat.c Mon Jan 12 01:11:07 2009 (r5122) +++ format-plugins/xmlformat/trunk/tests/check_xmlformat.c Mon Jan 12 01:58:48 2009 (r5123) @@ -243,9 +243,7 @@ char *testbed = setup_testbed("compare"); char *buffer1; - char *buffer2; unsigned int size1; - unsigned int size2; OSyncError *error = NULL; OSyncConvCmpResult result; @@ -256,14 +254,22 @@ fail_unless(xmlformat1 != NULL, NULL); fail_unless(error == NULL, NULL); - fail_unless(osync_file_read( "contact2.xml", &buffer2, &size2, &error), NULL); - - OSyncXMLFormat *xmlformat2 = osync_xmlformat_parse(buffer2, size2, &error); + OSyncXMLFormat *xmlformat2 = osync_xmlformat_new("contact", &error); fail_unless(xmlformat2 != NULL, NULL); fail_unless(error == NULL, NULL); + OSyncXMLField *name = osync_xmlfield_new(xmlformat2, "Name", &error); + fail_unless(name != NULL, NULL); + fail_unless(error == NULL, NULL); + + osync_xmlfield_set_key_value(name, "LastName", "llllllllll"); + osync_xmlfield_set_key_value(name, "FirstName", "ffffffffff"); + + OSyncXMLField *tel = osync_xmlfield_new(xmlformat2, "Telephone", &error); + osync_xmlfield_set_key_value(tel, "Content", "hhhhhhhhhh"); + osync_xmlfield_set_attr(tel, "Location", "Home"); + g_free(buffer1); - g_free(buffer2); result = compare_contact((char*)xmlformat1, osync_xmlformat_size(), (char*)xmlformat2, osync_xmlformat_size(), NULL); Modified: format-plugins/xmlformat/trunk/tests/data/compare/contact1.xml ============================================================================== --- format-plugins/xmlformat/trunk/tests/data/compare/contact1.xml Mon Jan 12 01:11:07 2009 (r5122) +++ format-plugins/xmlformat/trunk/tests/data/compare/contact1.xml Mon Jan 12 01:58:48 2009 (r5123) @@ -1,8 +1,5 @@ <?xml version="1.0"?> <contact> - <FormattedName> - <Content>ffffffffff llllllllll</Content> - </FormattedName> <Name> <LastName>llllllllll</LastName> <FirstName>ffffffffff</FirstName> @@ -10,7 +7,4 @@ <Telephone Location="Home"> <Content>hhhhhhhhhh</Content> </Telephone> - <Telephone Location="Work"> - <Content>wwwwwwwwww</Content> - </Telephone> </contact> |