44 } |
44 } |
45 |
45 |
46 void SearchInDeviceHandlerTest::testhandleAsyncSearchResult() |
46 void SearchInDeviceHandlerTest::testhandleAsyncSearchResult() |
47 { |
47 { |
48 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
48 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
49 indevicehandler->setCategory("file"); |
49 indevicehandler->setCategory("media"); |
50 QSignalSpy |
50 QSignalSpy |
51 spy(indevicehandler, SIGNAL(handleAsyncSearchResult(int, int))); |
51 spy(indevicehandler, SIGNAL(handleAsyncSearchResult(int, int))); |
52 indevicehandler->searchAsync("txt"); |
52 indevicehandler->searchAsync("jpg*"); |
53 QTest::qWait(200); |
53 QTest::qWait(2000); |
54 QCOMPARE(spy.count(), 1); |
54 QCOMPARE(spy.count(), 1); |
55 delete indevicehandler; |
55 delete indevicehandler; |
56 |
56 |
57 } |
57 } |
58 void SearchInDeviceHandlerTest::testhandleDocument() |
58 void SearchInDeviceHandlerTest::testhandleDocument() |
59 { |
59 { |
60 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
60 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
61 indevicehandler->setCategory("file"); |
61 indevicehandler->setCategory("media"); |
62 |
62 |
63 indevicehandler->searchAsync("txt"); |
63 indevicehandler->searchAsync("jpg*"); |
64 QTest::qWait(200); |
64 QTest::qWait(2000); |
65 |
65 |
66 QSignalSpy spy(indevicehandler, |
66 QSignalSpy spy(indevicehandler, |
67 SIGNAL(handleDocument(int, QCPixDocument*))); |
67 SIGNAL(handleDocument(int, QCPixDocument*))); |
68 indevicehandler->getDocumentAsyncAtIndex(0); |
68 indevicehandler->getDocumentAsyncAtIndex(0); |
69 QTest::qWait(200); |
69 QTest::qWait(2000); |
70 QCOMPARE(spy.count(), 1); |
70 QCOMPARE(spy.count(), 1); |
71 delete indevicehandler; |
71 delete indevicehandler; |
72 |
72 |
73 } |
73 } |
74 void SearchInDeviceHandlerTest::testgetSearchResult() |
74 void SearchInDeviceHandlerTest::testgetSearchResult() |
81 } |
81 } |
82 |
82 |
83 void SearchInDeviceHandlerTest::testgetDocumentAsyncAtIndex() |
83 void SearchInDeviceHandlerTest::testgetDocumentAsyncAtIndex() |
84 { |
84 { |
85 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
85 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
86 indevicehandler->setCategory("file"); |
86 indevicehandler->setCategory("media"); |
87 |
87 |
88 indevicehandler->searchAsync("txt"); |
88 indevicehandler->searchAsync("jpg*"); |
89 QTest::qWait(200); |
89 QTest::qWait(2000); |
90 QSignalSpy spy(indevicehandler, |
90 QSignalSpy spy(indevicehandler, |
91 SIGNAL(handleDocument(int, QCPixDocument*))); |
91 SIGNAL(handleDocument(int, QCPixDocument*))); |
92 indevicehandler->getDocumentAsyncAtIndex(0); |
92 indevicehandler->getDocumentAsyncAtIndex(0); |
93 QTest::qWait(200); |
93 QTest::qWait(2000); |
94 QCOMPARE(spy.count(), 1); |
94 QCOMPARE(spy.count(), 1); |
95 delete indevicehandler; |
95 delete indevicehandler; |
96 } |
96 } |
97 |
97 |
98 void SearchInDeviceHandlerTest::testsearchAsync() |
98 void SearchInDeviceHandlerTest::testsearchAsync() |
99 { |
99 { |
100 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
100 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
101 indevicehandler->setCategory("file"); |
101 indevicehandler->setCategory("media"); |
102 QSignalSpy spy(indevicehandler, SIGNAL(handleAsyncSearchResult(int,int))); |
102 QSignalSpy spy(indevicehandler, SIGNAL(handleAsyncSearchResult(int,int))); |
103 indevicehandler->searchAsync(NULL); |
103 indevicehandler->searchAsync(NULL); |
104 QTest::qWait(200); |
104 QTest::qWait(2000); |
105 QCOMPARE(spy.count(), 0); |
105 QCOMPARE(spy.count(), 0); |
106 indevicehandler->searchAsync("txt"); |
106 indevicehandler->searchAsync("jpg*"); |
107 QTest::qWait(200); |
107 QTest::qWait(2000); |
108 QCOMPARE(spy.count(), 1); |
108 QCOMPARE(spy.count(), 1); |
109 delete indevicehandler; |
109 delete indevicehandler; |
110 } |
110 } |
111 void SearchInDeviceHandlerTest::testcancelLastSearch() |
111 void SearchInDeviceHandlerTest::testcancelLastSearch() |
112 { |
112 { |
113 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
113 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
114 indevicehandler->setCategory("file"); |
114 indevicehandler->setCategory("media"); |
115 indevicehandler->searchAsync("txt"); |
115 indevicehandler->searchAsync("jpg*"); |
116 indevicehandler->cancelLastSearch(); |
116 indevicehandler->cancelLastSearch(); |
117 delete indevicehandler; |
117 delete indevicehandler; |
118 } |
118 } |
119 void SearchInDeviceHandlerTest::testgetSearchResultCount() |
119 void SearchInDeviceHandlerTest::testgetSearchResultCount() |
120 { |
120 { |
121 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
121 InDeviceHandler* indevicehandler = new InDeviceHandler(); |
122 QCOMPARE(indevicehandler->getSearchResultCount(),0); |
122 QCOMPARE(indevicehandler->getSearchResultCount(),0); |
123 indevicehandler->setCategory("file"); |
123 indevicehandler->setCategory("media"); |
124 indevicehandler->searchAsync("txt"); |
124 indevicehandler->searchAsync("jpg*"); |
125 QTest::qWait(200); |
125 QTest::qWait(2000); |
126 QVERIFY(indevicehandler->getSearchResultCount()); |
126 QVERIFY(indevicehandler->getSearchResultCount()); |
127 delete indevicehandler; |
127 delete indevicehandler; |
128 |
128 |
129 } |
129 } |
130 void SearchInDeviceHandlerTest::testsetCategory() |
130 void SearchInDeviceHandlerTest::testsetCategory() |