| | 1569 | |
|---|
| | 1570 | |
|---|
| | 1571 | START_TEST (check_parser_ctcap12_property_paramname) |
|---|
| | 1572 | { |
|---|
| | 1573 | |
|---|
| | 1574 | /* libsyncml ticket: #131 */ |
|---|
| | 1575 | char *data = "<?xml version=\"1.0\"?><!DOCTYPE SyncML PUBLIC \"-//SYNCML//DTD SyncML 1.2//EN\" \"http://www.openmobilealliance.org/tech/DTD/OMA-TS-SyncML_RepPro_DTD-V1_2.dtd\"><SyncML xmlns=\"syncml:SYNCML1.2\"><SyncHdr><VerDTD>1.2</VerDTD><VerProto>SyncML/1.2</VerProto><SessionID>1</SessionID><MsgID>1</MsgID><Target><LocURI>PC Suite Data Sync</LocURI></Target><Source><LocURI>IMEI:............</LocURI></Source><Meta><MaxMsgSize xmlns=\"syncml:metinf\">8000</MaxMsgSize></Meta></SyncHdr><SyncBody><Status><CmdID>1</CmdID><MsgRef>1</MsgRef><CmdRef>0</CmdRef><Cmd>SyncHdr</Cmd><TargetRef>/</TargetRef><SourceRef>PC Suite Data Sync</SourceRef><Data>200</Data></Status><Status><CmdID>2</CmdID><MsgRef>1</MsgRef><CmdRef>1</CmdRef><Cmd>Alert</Cmd><SourceRef>Contacts</SourceRef><Data>200</Data></Status><Put><CmdID>3</CmdID><Meta><Type xmlns=\"syncml:metinf\">application/vnd.syncml-devinf+xml</Type></Meta><Item><Source><LocURI>./devinf12</LocURI></Source><Data><DevInf xmlns=\"syncml:devinf\"><VerDTD>1.2</VerDTD><Man>Nokia</Man><Mod>Nokia 6555b</Mod><FwV>V 03.31\n01-08-07\nRM-289\n(c) N..</FwV><SwV>V 03.31\n01-08-07\nRM-289\n(c) N..</SwV><HwV>5005</HwV><DevID>IMEI:..............</DevID><DevTyp>phone</DevTyp><SupportLargeObjs/><SupportNumberOfChanges/><DataStore><SourceRef>/telecom/pb.vcf</SourceRef><MaxGUIDSize>8</MaxGUIDSize><Rx-Pref><CTType>text/x-vcard</CTType><VerCT>2.1</VerCT></Rx-Pref><Tx-Pref><CTType>text/x-vcard</CTType><VerCT>2.1</VerCT></Tx-Pref><SyncCap><SyncType>1</SyncType><SyncType>2</SyncType><SyncType>4</SyncType><SyncType>6</SyncType><SyncType>7</SyncType></SyncCap><CTCap><CTType>text/x-vcard</CTType><VerCT>2.1</VerCT><Property><PropName>BEGIN</PropName><ValEnum>VCARD</ValEnum></Property><Property><PropName>END</PropName><ValEnum>VCARD</ValEnum></Property><Property><PropName>N</PropName></Property><Property><PropName>FN</PropName></Property><Property><PropName>TEL</PropName><ParamName>PREF</ParamName><ParamName>WORK</ParamName><ParamName>HOME</ParamName><ParamName>VOICE</ParamName><ParamName>FAX</ParamName><ParamName>CELL</ParamName><ParamName>VIDEO</ParamName><ParamName>POC</ParamName></Property><Property><PropName>NOTE</PropName></Property><Property><PropName>URL</PropName></Property><Property><PropName>EMAIL</PropName></Property><Property><PropName>ADR</PropName></Property><Property><PropName>PHOTO</PropName></Property><Property><PropName>BDAY</PropName></Property><Property><PropName>TITLE</PropName></Property><Property><PropName>ORG</PropName></Property><Property><PropName>X-NICKNAME</PropName></Property><Property><PropName>X-SIP</PropName></Property><Property><PropName>X-WV-ID</PropName></Property></CTCap></DataStore><DataStore><SourceRef>/telecom/cal.vcs</SourceRef><MaxGUIDSize>8</MaxGUIDSize><Rx-Pref><CTType>text/x-vcalendar</CTType><VerCT>1.0</VerCT></Rx-Pref><Tx-Pref><CTType>text/x-vcalendar</CTType><VerCT>1.0</VerCT></Tx-Pref><SyncCap><SyncType>1</SyncType><SyncType>2</SyncType><SyncType>4</SyncType><SyncType>6</SyncType><SyncType>7</SyncType></SyncCap><CTCap><CTType>text/x-vcalendar</CTType><VerCT>1.0</VerCT><Property><PropName>BEGIN</PropName><ValEnum>VCALENDAR</ValEnum><ValEnum>VEVENT</ValEnum><ValEnum>VTODO</ValEnum></Property><Property><PropName>END</PropName><ValEnum>VCALENDAR</ValEnum><ValEnum>VEVENT</ValEnum><ValEnum>VTODO</ValEnum></Property><Property><PropName>DTSTART</PropName></Property><Property><PropName>DTEND</PropName></Property><Property><PropName>SUMMARY</PropName></Property><Property><PropName>DESCRIPTION</PropName></Property><Property><PropName>DUE</PropName></Property><Property><PropName>AALARM</PropName></Property><Property><PropName>DALARM</PropName></Property><Property><PropName>RRULE</PropName></Property><Property><PropName>CATEGORIES</PropName><ParamName>SPECIAL OCCASION</ParamName><ParamName>MEETING</ParamName><ParamName>PHONE CALL</ParamName><ParamName>MISCELLANEOUS</ParamName><ParamName>REMINDER</ParamName></Property><Property><PropName>LOCATION</PropName></Property><Property><PropName>STATUS</PropName><ParamName>NEEDS ACTION</ParamName><ParamName>COMPLETED</ParamName></Property><Property><PropName>PRIORITY</PropName><ParamName>1</ParamName><ParamName>2</ParamName><ParamName>3</ParamName></Property><Property><PropName>EXDATE</PropName></Property></CTCap></DataStore><DataStore><SourceRef>/telecom/note.txt</SourceRef><MaxGUIDSize>8</MaxGUIDSize><Rx-Pref><CTType>text/plain</CTType><VerCT/></Rx-Pref><Tx-Pref><CTType>text/plain</CTType><VerCT/></Tx-Pref><SyncCap><SyncType>1</SyncType><SyncType>2</SyncType><SyncType>4</SyncType><SyncType>6</SyncType><SyncType>7</SyncType></SyncCap><CTCap><CTType>text/plain</CTType><VerCT/><Property><PropName/><DataType>chr</DataType><Size>3000</Size></Property></CTCap></DataStore></DevInf></Data></Item></Put><Get><CmdID>4</CmdID><Meta><Type xmlns=\"syncml:metinf\">application/vnd.syncml-devinf+xml</Type></Meta><Item><Target><LocURI>./devinf12</LocURI></Target></Item></Get><Alert><CmdID>5</CmdID><Data>201</Data><Item><Target><LocURI>Contacts</LocURI></Target><Source><LocURI>/telecom/pb.vcf</LocURI></Source><Meta><Anchor xmlns=\"syncml:metinf\"><Last>0</Last><Next>92</Next></Anchor></Meta></Item></Alert><Final/></SyncBody></SyncML>"; |
|---|
| | 1576 | |
|---|
| | 1577 | SmlParser *parser = start_parser(data); |
|---|
| | 1578 | fail_unless(parser != NULL, NULL); |
|---|
| | 1579 | |
|---|
| | 1580 | SmlError *error = NULL; |
|---|
| | 1581 | SmlHeader *header = NULL; |
|---|
| | 1582 | SmlCred *cred = NULL; |
|---|
| | 1583 | |
|---|
| | 1584 | fail_unless(smlParserGetHeader(parser, &header, &cred, &error), NULL); |
|---|
| | 1585 | fail_unless(header != NULL, NULL); |
|---|
| | 1586 | fail_unless(cred == NULL, NULL); |
|---|
| | 1587 | fail_unless(error == NULL, NULL); |
|---|
| | 1588 | |
|---|
| | 1589 | fail_unless(header->messageID == 1, NULL); |
|---|
| | 1590 | smlHeaderFree(header); |
|---|
| | 1591 | |
|---|
| | 1592 | SmlStatus *status = NULL; |
|---|
| | 1593 | fail_unless(smlParserGetStatus(parser, &status, &error), NULL); |
|---|
| | 1594 | fail_unless(status != NULL, NULL); |
|---|
| | 1595 | fail_unless(error == NULL, NULL); |
|---|
| | 1596 | |
|---|
| | 1597 | fail_unless(smlParserGetStatus(parser, &status, &error), NULL); |
|---|
| | 1598 | fail_unless(status != NULL, NULL); |
|---|
| | 1599 | fail_unless(error == NULL, NULL); |
|---|
| | 1600 | |
|---|
| | 1601 | SmlCommand *cmd = NULL; fail_unless(smlParserGetCommand(parser, &cmd, &error) == SML_PARSER_RESULT_NORMAL, NULL); |
|---|
| | 1602 | fail_unless(cmd != NULL, NULL); |
|---|
| | 1603 | fail_unless(error == NULL, NULL); |
|---|
| | 1604 | fail_unless(cmd->cmdID == 3, NULL); |
|---|
| | 1605 | fail_unless(cmd->type == SML_COMMAND_TYPE_PUT, NULL); |
|---|
| | 1606 | fail_unless(cmd->private.access.item != NULL, NULL); |
|---|
| | 1607 | |
|---|
| | 1608 | char *buffer = NULL; |
|---|
| | 1609 | unsigned int size = 0; |
|---|
| | 1610 | fail_unless(smlItemGetData(cmd->private.access.item, &buffer, &size, &error), NULL); |
|---|
| | 1611 | fail_unless(error == NULL, NULL); |
|---|
| | 1612 | |
|---|
| | 1613 | SmlDevInf *devinf = smlDevInfParse(buffer, size, &error); |
|---|
| | 1614 | fail_unless(devinf != NULL, NULL); |
|---|
| | 1615 | fail_unless(error == NULL, NULL); |
|---|
| | 1616 | smlDevInfUnref(devinf); |
|---|
| | 1617 | |
|---|
| | 1618 | smlCommandUnref(cmd); |
|---|
| | 1619 | |
|---|
| | 1620 | fail_unless(smlParserGetCommand(parser, &cmd, &error) == SML_PARSER_RESULT_NORMAL, NULL); |
|---|
| | 1621 | fail_unless(cmd != NULL, NULL); |
|---|
| | 1622 | fail_unless(error == NULL, NULL); |
|---|
| | 1623 | |
|---|
| | 1624 | smlCommandUnref(cmd); |
|---|
| | 1625 | |
|---|
| | 1626 | fail_unless(smlParserGetCommand(parser, &cmd, &error) == SML_PARSER_RESULT_NORMAL, NULL); |
|---|
| | 1627 | fail_unless(cmd != NULL, NULL); |
|---|
| | 1628 | fail_unless(error == NULL, NULL); |
|---|
| | 1629 | |
|---|
| | 1630 | SmlBool final = FALSE; |
|---|
| | 1631 | SmlBool end = TRUE; |
|---|
| | 1632 | fail_unless(smlParserEnd(parser, &final, &end, &error), NULL); |
|---|
| | 1633 | fail_unless(error == NULL, NULL); |
|---|
| | 1634 | fail_unless(final == TRUE, NULL); |
|---|
| | 1635 | fail_unless(end == FALSE, NULL); |
|---|
| | 1636 | |
|---|
| | 1637 | smlParserFree(parser); |
|---|
| | 1638 | } |
|---|
| | 1639 | END_TEST |
|---|
| | 1640 | |
|---|