mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
Added test for child msg retrieval
ui improvement for comments git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5577 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2e3e5b4ee4
commit
1aeae0390a
@ -752,7 +752,7 @@ bool RsGxsDataAccess::getMsgSummary(MsgMetaReq* req)
|
||||
}
|
||||
|
||||
|
||||
bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq msgIdsOut)
|
||||
bool RsGxsDataAccess::getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq& msgIdsOut)
|
||||
{
|
||||
GxsMsgMetaResult result;
|
||||
|
||||
@ -1009,8 +1009,6 @@ bool RsGxsDataAccess::getMsgRelatedInfo(MsgRelatedInfoReq *req)
|
||||
|
||||
MsgMetaFilter filterMap;
|
||||
|
||||
RsStackMutex stack(mDataMutex); /***** LOCKED *****/
|
||||
|
||||
// get meta data for all in group
|
||||
GxsMsgMetaResult result;
|
||||
GxsMsgReq msgIds;
|
||||
|
@ -350,7 +350,7 @@ private:
|
||||
* @param opts the options used to parameterise the id filter
|
||||
* @param msgIdsOut the left overs ids after filter is applied to msgIds
|
||||
*/
|
||||
bool getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq msgIdsOut);
|
||||
bool getMsgList(const GxsMsgReq& msgIds, const RsTokReqOptionsV2& opts, GxsMsgReq& msgIdsOut);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -725,6 +725,118 @@ bool GenExchangeTester::testMsgIdRetrieval()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testMsgChildRetrieval()
|
||||
{
|
||||
// start up
|
||||
setUp();
|
||||
setUpGrps();
|
||||
|
||||
/********************/
|
||||
|
||||
|
||||
// create msgs
|
||||
// then make all requests immediately then poll afterwards for each and run outbound test
|
||||
// we want only latest for now
|
||||
int nMsgs = (rand()%50)+2; // test a large number of msgs
|
||||
std::vector<RsDummyMsg*> msgs;
|
||||
createMsgs(msgs, nMsgs);
|
||||
RsTokReqOptionsV2 opts;
|
||||
opts.mReqType = 4000;
|
||||
uint32_t token;
|
||||
|
||||
bool first = true;
|
||||
RsGxsGrpMsgIdPair firstMsgId;
|
||||
|
||||
// everyone is parent of first msg
|
||||
|
||||
for(int i=0; i < nMsgs; i++)
|
||||
{
|
||||
RsDummyMsg* msg = msgs[i];
|
||||
|
||||
int j = rand()%5;
|
||||
|
||||
|
||||
if(first){
|
||||
msg->meta.mParentId = "";
|
||||
msg->meta.mOrigMsgId = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg->meta.mParentId = firstMsgId.second;
|
||||
msg->meta.mGroupId = firstMsgId.first;
|
||||
msg->meta.mOrigMsgId = "";
|
||||
}
|
||||
|
||||
mTestService->publishDummyMsg(token, msg);
|
||||
pollForToken(token, opts);
|
||||
RsGxsGrpMsgIdPair msgId;
|
||||
mTestService->acknowledgeTokenMsg(token, msgId);
|
||||
|
||||
// less than half have no parents
|
||||
if(first){
|
||||
firstMsgId.second = msgId.second;
|
||||
firstMsgId.first = msgId.first;
|
||||
|
||||
}
|
||||
|
||||
if(msgId.first.empty() || msgId.second.empty())
|
||||
{
|
||||
breakDown();
|
||||
std::cerr << "serious error: Acknowledgement failed! " << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!first)
|
||||
{
|
||||
mMsgIdsOut[msgId.first].push_back(msgId.second);
|
||||
first = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_PARENT | RS_TOKREQOPT_MSG_LATEST;
|
||||
mTokenService->requestMsgRelatedInfo(token, 0, opts, firstMsgId);
|
||||
|
||||
pollForToken(token, opts);
|
||||
|
||||
GxsMsgIdResult::iterator mit = mMsgIdsOut.begin();
|
||||
for(; mit != mMsgIdsOut.end(); mit++)
|
||||
{
|
||||
std::vector<RsGxsMessageId> msgIdsOut, msgIdsIn;
|
||||
msgIdsOut = mit->second;
|
||||
|
||||
std::vector<RsGxsMessageId>::iterator vit_out = msgIdsOut.begin(), vit_in;
|
||||
|
||||
for(; vit_out != msgIdsOut.end(); vit_out++)
|
||||
{
|
||||
bool found = false;
|
||||
msgIdsIn = mMsgIdsIn[mit->first];
|
||||
vit_in = msgIdsIn.begin();
|
||||
|
||||
for(; vit_in != msgIdsIn.end(); vit_in++)
|
||||
{
|
||||
if(*vit_in == *vit_out)
|
||||
found = true;
|
||||
}
|
||||
|
||||
if(!found){
|
||||
breakDown();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/********************/
|
||||
|
||||
// complete
|
||||
breakDown();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GenExchangeTester::testSpecificMsgMetaRetrieval()
|
||||
{
|
||||
|
||||
@ -874,12 +986,12 @@ bool GenExchangeTester::testMsgIdRetrieval_OptParents()
|
||||
|
||||
}
|
||||
|
||||
GxsMsgReq req;
|
||||
std::list<RsGxsGroupId> req;
|
||||
|
||||
// use empty grp ids request types, non specific msgs ids
|
||||
for(int i=0; i < mRandGrpIds.size(); i++)
|
||||
{
|
||||
req[mRandGrpIds[i]] = std::vector<RsGxsMessageId>();
|
||||
req.push_back(mRandGrpIds[i]);
|
||||
}
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
@ -971,12 +1083,12 @@ bool GenExchangeTester::testMsgIdRetrieval_OptOrigMsgId()
|
||||
|
||||
}
|
||||
|
||||
GxsMsgReq req;
|
||||
std::list<RsGxsGroupId> req;
|
||||
|
||||
// use empty grp ids request types, non specific msgs ids
|
||||
for(int i=0; i < mRandGrpIds.size(); i++)
|
||||
{
|
||||
req[mRandGrpIds[i]] = std::vector<RsGxsMessageId>();
|
||||
req.push_back(mRandGrpIds[i]);
|
||||
}
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
@ -1181,10 +1293,10 @@ bool GenExchangeTester::testMsgIdRetrieval_OptLatest()
|
||||
|
||||
|
||||
// use empty grp ids request types, non specific msgs ids
|
||||
GxsMsgReq req;
|
||||
std::list<RsGxsGroupId> req;
|
||||
for(int i=0; i < mRandGrpIds.size(); i++)
|
||||
{
|
||||
req[mRandGrpIds[i]] = std::vector<RsGxsMessageId>();
|
||||
req.push_back(mRandGrpIds[i]);
|
||||
}
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_IDS;
|
||||
|
@ -32,6 +32,9 @@ public:
|
||||
bool testMsgIdRetrieval_OptLatest();
|
||||
bool testSpecificMsgMetaRetrieval();
|
||||
|
||||
bool testMsgChildRetrieval();
|
||||
|
||||
|
||||
bool testGrpSubmissionRetrieval();
|
||||
bool testSpecificGrpRetrieval();
|
||||
bool testGrpIdRetrieval();
|
||||
|
@ -75,6 +75,73 @@ linux-g++-64 {
|
||||
OBJECTS_DIR = temp/linux-g++-64/obj
|
||||
}
|
||||
|
||||
#################################### Windows #####################################
|
||||
|
||||
win32 {
|
||||
|
||||
DEFINES *= WINDOWS_SYS \
|
||||
WIN32 \
|
||||
STATICLIB \
|
||||
MINGW
|
||||
# Switch on extra warnings
|
||||
QMAKE_CFLAGS += -Wextra
|
||||
QMAKE_CXXFLAGS += -Wextra
|
||||
|
||||
# Switch off optimization for release version
|
||||
QMAKE_CXXFLAGS_RELEASE -= -O2
|
||||
QMAKE_CXXFLAGS_RELEASE += -O0
|
||||
QMAKE_CFLAGS_RELEASE -= -O2
|
||||
QMAKE_CFLAGS_RELEASE += -O0
|
||||
|
||||
# Switch on optimization for debug version
|
||||
#QMAKE_CXXFLAGS_DEBUG += -O2
|
||||
#QMAKE_CFLAGS_DEBUG += -O2
|
||||
|
||||
# PRE_TARGETDEPS += ../../libretroshare/src/lib/libretroshare.a
|
||||
PRE_TARGETDEPS += ../../../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
|
||||
|
||||
LIBS += ../../../../libretroshare/libretroshare-build-desktop/lib/libretroshare.a
|
||||
LIBS += C:\Development\Rs\v0.5-gxs-b1\openpgpsdk\openpgpsdk-build-desktop\lib\libops.a
|
||||
LIBS += C:\Development\Libraries\sqlite\sqlite-autoconf-3070900\lib\libsqlite3.a
|
||||
LIBS += -L"../../../../../lib"
|
||||
LIBS += -lssl -lcrypto -lgpgme -lpthreadGC2d -lminiupnpc -lz -lbz2
|
||||
# added after bitdht
|
||||
# LIBS += -lws2_32
|
||||
LIBS += -luuid -lole32 -liphlpapi -lcrypt32-cygwin -lgdi32
|
||||
LIBS += -lole32 -lwinmm
|
||||
|
||||
# export symbols for the plugins
|
||||
#LIBS += -Wl,--export-all-symbols,--out-implib,lib/libretroshare-gui.a
|
||||
|
||||
GPG_ERROR_DIR = ../../../../libgpg-error-1.7
|
||||
GPGME_DIR = ../../../../gpgme-1.1.8
|
||||
GPG_ERROR_DIR = ../../../../lib/libgpg-error-1.7
|
||||
GPGME_DIR = ../../../../lib/gpgme-1.1.8
|
||||
INCLUDEPATH += . $${GPGME_DIR}/src $${GPG_ERROR_DIR}/src
|
||||
|
||||
SQLITE_DIR = ../../../../../../Libraries/sqlite/sqlite-autoconf-3070900
|
||||
INCLUDEPATH += . \
|
||||
$${SQLITE_DIR}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
bitdht {
|
||||
LIBS += C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||
PRE_TARGETDEPS *= C:\Development\Rs\v0.5-gxs-b1\libbitdht\libbitdht-build-desktop\lib\libbitdht.a
|
||||
|
||||
# Chris version.
|
||||
#LIBS += ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
#PRE_TARGETDEPS *= ../../libbitdht/libbitdht-build-desktop/lib/libbitdht.a
|
||||
}
|
||||
|
||||
win32 {
|
||||
# must be added after bitdht
|
||||
LIBS += -lws2_32
|
||||
}
|
||||
|
||||
version_detail_bash_script {
|
||||
DEFINES += ADD_LIBRETROSHARE_VERSION_INFO
|
||||
QMAKE_EXTRA_TARGETS += write_version_detail
|
||||
@ -120,4 +187,4 @@ gen_exchange_target {
|
||||
|
||||
}
|
||||
|
||||
INCLUDEPATH += ../../
|
||||
INCLUDEPATH += ../../
|
||||
|
@ -14,13 +14,14 @@ int main()
|
||||
{
|
||||
GenExchangeTester tester;
|
||||
|
||||
CHECK(tester.testMsgSubmissionRetrieval()); REPORT("testMsgSubmissionRetrieval()");
|
||||
// CHECK(tester.testMsgSubmissionRetrieval()); REPORT("testMsgSubmissionRetrieval()");
|
||||
// CHECK(tester.testSpecificMsgMetaRetrieval()); REPORT("testSpecificMsgMetaRetrieval()");
|
||||
// CHECK(tester.testMsgIdRetrieval()); REPORT("tester.testMsgIdRetrieval()");
|
||||
// CHECK(tester.testMsgIdRetrieval_OptParents()); REPORT("tester.testRelatedMsgIdRetrieval_Parents()");
|
||||
// CHECK(tester.testMsgIdRetrieval()); REPORT("tester.testMsgIdRetrieval()");
|
||||
//CHECK(tester.testMsgIdRetrieval_OptParents()); REPORT("tester.testRelatedMsgIdRetrieval_Parents()");
|
||||
// CHECK(tester.testMsgIdRetrieval_OptOrigMsgId()); REPORT("tester.testRelatedMsgIdRetrieval_OrigMsgId()");
|
||||
// CHECK(tester.testMsgIdRetrieval_OptLatest()); REPORT("tester.testRelatedMsgIdRetrieval_Latest()");
|
||||
// CHECK(tester.testMsgMetaModRequest()); REPORT("tester.testMsgMetaModRequest()");
|
||||
//CHECK(tester.testMsgMetaModRequest()); REPORT("tester.testMsgMetaModRequest()");
|
||||
CHECK(tester.testMsgChildRetrieval()); REPORT("tester.testMsgMetaModRequest()");
|
||||
|
||||
// CHECK(tester.testGrpSubmissionRetrieval()); REPORT("tester.testGrpSubmissionRetrieval()");
|
||||
// CHECK(tester.testGrpMetaRetrieval()); REPORT("tester.testGrpMetaRetrieval()");
|
||||
|
@ -1,21 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>PhotoCommentItem</class>
|
||||
<widget class="QWidget" name="PhotoCommentItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
<width>484</width>
|
||||
<height>110</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="expandFrame">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#expandFrame{border: 2px solid #D3D3D3;
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #FFFFFF, stop:1 #F2F2F2);;
|
||||
border-radius: 10px;}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="msgWidget" native="true">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget#msgWidget{border: 2px solid #238;
|
||||
border-radius: 10px;}</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="margin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="msgLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<stylestrategy>PreferAntialias</stylestrategy>
|
||||
</font>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
Loading…
Reference in New Issue
Block a user