23
|
1 |
#include "t_contentinfodb.h"
|
|
2 |
#include "cpixcontentinfodbdef.h"
|
|
3 |
#include "cpixcontentinfodbread.h"
|
|
4 |
#include <qsignalspy.h>
|
|
5 |
#include <QSqlDatabase>
|
|
6 |
#include <qsqlquery.h>
|
|
7 |
#include <qdebug.h>
|
|
8 |
ContentinfodbTest::ContentinfodbTest()
|
|
9 |
{
|
|
10 |
}
|
|
11 |
ContentinfodbTest::~ContentinfodbTest()
|
|
12 |
{
|
|
13 |
}
|
|
14 |
void ContentinfodbTest::init()
|
|
15 |
{
|
|
16 |
|
|
17 |
}
|
|
18 |
void ContentinfodbTest::initTestCase()
|
|
19 |
{
|
|
20 |
}
|
|
21 |
void ContentinfodbTest::cleanupTestCase()
|
|
22 |
{
|
|
23 |
}
|
|
24 |
void ContentinfodbTest::Testupdate()
|
|
25 |
{
|
|
26 |
/*ContentInfoDbUpdate *ptr = new ContentInfoDbUpdate();
|
|
27 |
ptr->UpdateDb("C:\\data\\contact.xml");
|
|
28 |
ptr->UpdateDb("C:\\data\\application.xml");
|
|
29 |
ptr->UpdateDb("C:\\data\\audio.xml");
|
|
30 |
ptr->UpdateDb("C:\\data\\video.xml");
|
|
31 |
ptr->UpdateDb("C:\\data\\photos.xml");
|
|
32 |
ptr->UpdateDb("C:\\data\\notes.xml");
|
|
33 |
ptr->UpdateDb("C:\\data\\calendar.xml");
|
|
34 |
ptr->UpdateDb("C:\\data\\smsmms.xml");
|
|
35 |
ptr->UpdateDb("C:\\data\\files.xml");
|
|
36 |
ptr->UpdateDb("C:\\data\\email.xml"); */
|
|
37 |
}
|
|
38 |
void ContentinfodbTest::TestRead()
|
|
39 |
{
|
|
40 |
/* ContentInfoDbReadPrivate *ptr = new ContentInfoDbReadPrivate(NULL);
|
|
41 |
QStringList list = ptr->getPrimaryKeys();
|
|
42 |
qDebug() << "primarykeys"<<list;
|
|
43 |
for(int i =0;i<list.count();i++)
|
|
44 |
{
|
|
45 |
qDebug() << ptr->getValues(list.at(i),INDEXINGSTATUS);
|
|
46 |
qDebug() << ptr->getValues(list.at(i),BLACKLISTSTATUS);
|
|
47 |
qDebug() << ptr->getValues(list.at(i),DISPLAYICON);
|
|
48 |
qDebug() << ptr->getValues(list.at(i),DISPLAYNAME);
|
|
49 |
qDebug() << ptr->getValues(list.at(i),EXPECTIONID);
|
|
50 |
qDebug() << ptr->getValues(list.at(i),DISPLAYORDER);
|
|
51 |
qDebug() << ptr->getValues(list.at(i),TRANSLATION);
|
|
52 |
qDebug() << ptr->getShortTaburi(list.at(i));
|
|
53 |
if (list.at(i) == "Video" || list.at(i) == "Audio" || list.at(i)
|
|
54 |
== "Photo")
|
|
55 |
{
|
|
56 |
qDebug() << ptr->getLongTaburi(list.at(i), "Name");
|
|
57 |
qDebug() << ptr->getLongTaburi(list.at(i), "Title");
|
|
58 |
}
|
|
59 |
else if (list.at(i) == "Contact")
|
|
60 |
{
|
|
61 |
qDebug() << ptr->getLongTaburi(list.at(i), "FAMILYNAME");
|
|
62 |
qDebug() << ptr->getLongTaburi(list.at(i), "COMPANY");
|
|
63 |
}
|
|
64 |
else if (list.at(i) == "Application")
|
|
65 |
{
|
|
66 |
qDebug() << ptr->getLongTaburi(list.at(i), "Name");
|
|
67 |
}
|
|
68 |
else if (list.at(i) == "Notes")
|
|
69 |
{
|
|
70 |
qDebug() << ptr->getLongTaburi(list.at(i), "Memo");
|
|
71 |
qDebug() << ptr->getLongTaburi(list.at(i), "Date");
|
|
72 |
}
|
|
73 |
else if (list.at(i) == "Calendar")
|
|
74 |
{
|
|
75 |
qDebug() << ptr->getLongTaburi(list.at(i), "Summary");
|
|
76 |
qDebug() << ptr->getLongTaburi(list.at(i), "Description");
|
|
77 |
}
|
|
78 |
else if (list.at(i) == "smsmms")
|
|
79 |
{
|
|
80 |
qDebug() << ptr->getLongTaburi(list.at(i), "To");
|
|
81 |
qDebug() << ptr->getLongTaburi(list.at(i), "Body");
|
|
82 |
}
|
|
83 |
else if (list.at(i) == "Files")
|
|
84 |
{
|
|
85 |
qDebug() << ptr->getLongTaburi(list.at(i), "Name");
|
|
86 |
qDebug() << ptr->getLongTaburi(list.at(i), "Extension");
|
|
87 |
}
|
|
88 |
else if (list.at(i) == "Email")
|
|
89 |
{
|
|
90 |
qDebug() << ptr->getLongTaburi(list.at(i), "Sender");
|
|
91 |
qDebug() << ptr->getLongTaburi(list.at(i), "Subject");
|
|
92 |
}
|
|
93 |
QStringList listuri = ptr->getActionuri(list.at(i));
|
|
94 |
qDebug() << listuri;
|
|
95 |
QString str1,str2;
|
|
96 |
for(int j=0;j<listuri.count();j++)
|
|
97 |
{
|
|
98 |
ptr->geturiDetails(list.at(i),listuri.at(j),str1,str2);
|
|
99 |
qDebug() << str1<<str2;
|
|
100 |
}
|
|
101 |
}*/
|
|
102 |
}
|
|
103 |
void ContentinfodbTest::TestDelete()
|
|
104 |
{
|
|
105 |
ContentInfoDbUpdate *ptr = new ContentInfoDbUpdate();
|
|
106 |
ContentInfoDbReadPrivate *ptrread = new ContentInfoDbReadPrivate(NULL);
|
|
107 |
QStringList list = ptrread->getPrimaryKeys();
|
|
108 |
for (int i = 0; i < list.count(); i++)
|
|
109 |
{
|
|
110 |
if (i = 1)
|
|
111 |
ptr->deleteCategory(list.at(i));
|
|
112 |
}
|
|
113 |
}
|
|
114 |
void ContentinfodbTest::TestCount()
|
|
115 |
{
|
|
116 |
ContentInfoDbReadPrivate *ptrread = new ContentInfoDbReadPrivate(NULL);
|
|
117 |
int ret;
|
|
118 |
ret = ptrread->categoryCount();
|
|
119 |
ret = 0;
|
|
120 |
}
|
|
121 |
QTEST_MAIN( ContentinfodbTest)
|
|
122 |
|