Changeset 3428

Show
Ignore:
Timestamp:
07/10/08 08:54:28 (2 months ago)
Author:
bricks
Message:

Changed tests of xmlformat to use OSyncXMLFormatSchema

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tests/merger-tests/check_xmlformat.c

    r3370 r3428  
    33#include <opensync/opensync-xmlformat.h> 
    44 
    5 #include "opensync/xmlformat/opensync_xmlformat_internals.h" 
     5#include "opensync/xmlformat/opensync-xmlformat_internals.h" 
    66 
    77START_TEST (xmlformat_new) 
     
    276276        unsigned int size; 
    277277        OSyncError *error = NULL; 
     278        OSyncXMLFormatSchema *schema = NULL; 
    278279 
    279280        fail_unless(osync_file_read("event.xml", &buffer, &size, &error), NULL); 
     
    284285 
    285286        g_free(buffer); 
    286  
    287         fail_unless(_osync_xmlformat_validate(xmlformat, testbed) != FALSE, NULL); 
    288  
     287        schema = osync_xmlformat_schema_new(xmlformat, testbed, &error); 
     288        fail_if( schema == NULL ); 
     289        fail_unless( osync_xmlformat_schema_validate(schema, xmlformat, &error) ); 
     290         
     291        osync_xmlformat_schema_unref(schema); 
     292         
    289293        osync_xmlformat_unref(xmlformat); 
    290294 
     
    362366 
    363367        destroy_testbed(testbed); 
     368} 
     369END_TEST 
     370 
     371START_TEST (xmlformat_schema_get_instance) 
     372{ 
     373        OSyncError *error = NULL; 
     374        OSyncXMLFormat *xmlformat = osync_xmlformat_new("contact", &error); 
     375        fail_unless(xmlformat != NULL, NULL); 
     376        fail_unless(error == NULL, NULL); 
     377         
     378        OSyncXMLFormatSchema *schema1 = osync_xmlformat_schema_get_instance(xmlformat, &error); 
     379        OSyncXMLFormatSchema *schema2 = osync_xmlformat_schema_get_instance(xmlformat, &error); 
     380         
     381        fail_unless( schema1 == schema2 ); 
     382        fail_unless( schema1->ref_count == 2 ); 
     383 
     384        osync_xmlformat_schema_unref(schema1); 
     385        osync_xmlformat_schema_unref(schema2); 
     386 
    364387} 
    365388END_TEST 
     
    380403        create_case(s, "xmlformat_event_schema", xmlformat_event_schema); 
    381404 
     405        // xmlformat schema 
     406        create_case(s, "xmlformat_schema_get_instance", xmlformat_schema_get_instance); 
     407 
    382408        // xmlfield 
    383409        create_case(s, "xmlfield_new", xmlfield_new);