mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-11 10:35:22 -04:00
added new msg tag feature for retroshare messages.
update rsmsg iface so need full recompile for gui added serialiser test for new tag rsitems git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3379 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
c6537bbe09
commit
331ed93720
10 changed files with 564 additions and 21 deletions
|
@ -1,4 +1,3 @@
|
|||
<<<<<<< .mine
|
||||
/*
|
||||
* libretroshare/src/serialiser: distribitem_test.cc
|
||||
*
|
||||
|
@ -30,7 +29,7 @@
|
|||
#include "serialiser/rschannelitems.h"
|
||||
#include "serialiser/rsforumitems.h"
|
||||
#include "serialiser/rsblogitems.h"
|
||||
#include "rsiface/rsdistrib.h"
|
||||
#include "retroshare/rsdistrib.h"
|
||||
#include "serialiser/rstlvutil.h"
|
||||
#include "util/utest.h"
|
||||
#include "support.h"
|
||||
|
|
|
@ -74,13 +74,33 @@ RsSerialType* init_item(RsMsgItem& mi)
|
|||
randString(LARGE_STR, mi.message);
|
||||
randString(SHORT_STR, mi.subject);
|
||||
|
||||
mi.recvTime = rand()%32;
|
||||
mi.msgId = rand()%324232;
|
||||
mi.recvTime = rand()%44252;
|
||||
mi.sendTime = mi.recvTime;
|
||||
mi.msgFlags = mi.recvTime;
|
||||
|
||||
return new RsMsgSerialiser(true);
|
||||
}
|
||||
|
||||
RsSerialType* init_item(RsMsgTagType& mtt)
|
||||
{
|
||||
mtt.rgb_color = rand()%5353;
|
||||
mtt.tagId = rand()%24242;
|
||||
randString(SHORT_STR, mtt.text);
|
||||
|
||||
return new RsMsgSerialiser();
|
||||
}
|
||||
|
||||
|
||||
RsSerialType* init_item(RsMsgTags& mt)
|
||||
{
|
||||
randString(SHORT_STR, mt.msgId);
|
||||
mt.tagId = rand()%3334;
|
||||
|
||||
return new RsMsgSerialiser();
|
||||
}
|
||||
|
||||
|
||||
bool operator ==(const RsChatMsgItem& cmiLeft,const RsChatMsgItem& cmiRight)
|
||||
{
|
||||
|
||||
|
@ -131,6 +151,7 @@ bool operator ==(const RsMsgItem& miLeft, const RsMsgItem& miRight)
|
|||
if(miLeft.recvTime != miRight.recvTime) return false;
|
||||
if(miLeft.sendTime != miRight.sendTime) return false;
|
||||
if(miLeft.subject != miRight.subject) return false;
|
||||
if(miLeft.msgId != miRight.msgId) return false;
|
||||
|
||||
if(!(miLeft.attachment == miRight.attachment)) return false;
|
||||
if(!(miLeft.msgbcc == miRight.msgbcc)) return false;
|
||||
|
@ -140,7 +161,22 @@ bool operator ==(const RsMsgItem& miLeft, const RsMsgItem& miRight)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool operator ==(const RsMsgTagType& mttLeft, const RsMsgTagType& mttRight)
|
||||
{
|
||||
if(mttLeft.rgb_color != mttRight.rgb_color) return false;
|
||||
if(mttLeft.tagId != mttRight.tagId) return false;
|
||||
if(mttLeft.text != mttRight.text) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool operator ==(const RsMsgTags& mtLeft, const RsMsgTags& mtRight)
|
||||
{
|
||||
if(mtLeft.msgId != mtRight.msgId) return false;
|
||||
if(mtLeft.tagId != mtRight.tagId) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
|
@ -148,6 +184,10 @@ int main()
|
|||
test_RsItem<RsChatStatusItem >(); REPORT("Serialise/Deserialise RsChatStatusItem");
|
||||
test_RsItem<RsChatAvatarItem >(); REPORT("Serialise/Deserialise RsChatAvatarItem");
|
||||
test_RsItem<RsMsgItem >(); REPORT("Serialise/Deserialise RsMsgItem");
|
||||
test_RsItem<RsMsgTagType>(); REPORT("Serialise/Deserialise RsMsgTagType");
|
||||
test_RsItem<RsMsgTags>(); REPORT("Serialise/Deserialise RsMsgTags");
|
||||
|
||||
std::cerr << std::endl;
|
||||
|
||||
FINALREPORT("RsMsgItem Tests");
|
||||
|
||||
|
|
|
@ -35,12 +35,14 @@ RsSerialType* init_item(RsChatMsgItem& );
|
|||
RsSerialType* init_item(RsChatStatusItem& );
|
||||
RsSerialType* init_item(RsChatAvatarItem& );
|
||||
RsSerialType* init_item(RsMsgItem& );
|
||||
RsSerialType* init_item(RsMsgTagType& );
|
||||
RsSerialType* init_item(RsMsgTags& );
|
||||
|
||||
bool operator ==(const RsChatMsgItem& ,const RsChatMsgItem& );
|
||||
bool operator ==(const RsChatStatusItem& , const RsChatStatusItem& );
|
||||
bool operator ==(const RsChatAvatarItem&, const RsChatAvatarItem& );
|
||||
|
||||
// TODO: does not test for msgId
|
||||
bool operator ==(const RsMsgTagType&, const RsMsgTagType& );
|
||||
bool operator ==(const RsMsgTags&, const RsMsgTags& );
|
||||
bool operator ==(const RsMsgItem&, const RsMsgItem& );
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue