diff -r a10844a9914d -r a60f8b6b1d32 hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp --- a/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp Fri Sep 17 15:55:58 2010 +0300 +++ b/hgcacheproxymodel/tsrc/unit/test_hgcacheproxydatamodel.cpp Wed Oct 06 14:53:41 2010 +0300 @@ -1414,6 +1414,81 @@ } +void TestCacheProxy::testCP_IsCached() +{ + cp = new HgCacheProxyModel(); + dph = new DataProviderHelper(1000); + cp->setDataProvider(dph); + + QModelIndex idx = cp->index(0, 0); + QVariant res = cp->data(idx, Qt::DisplayRole); //this will move buffer to 0-119 + int begin = 0; + int end = 120; + int size = dph->getCount(); + for (int i=0; iisCached(i))==((i>=begin)&& (iindex(50, 0); + cp->data(idx, Qt::DisplayRole); //don't move buffer yet + for (int i=0; iisCached(i))==((i>=begin)&& (iindex(89, 0);//don't move buffer yet + cp->data(idx, Qt::DisplayRole); + for (int i=0; iisCached(i))==((i>=begin)&& (iindex(100, 0); //now move buffer + cp->data(idx, Qt::DisplayRole); + begin = 40; + end = 160; + for (int i=0; iisCached(i))==((i>=begin)&& (iindex(500, 0); //move buffer + cp->data(idx, Qt::DisplayRole); + begin = 440; + end = 560; + for (int i=0; iisCached(i))==((i>=begin)&& (iindex(980, 0); //move buffer + cp->data(idx, Qt::DisplayRole); + begin = 880; + end = 1000; + for (int i=0; iisCached(i))==((i>=begin)&& (iindex(920, 0); //move buffer + cp->data(idx, Qt::DisplayRole); + begin = 880; + end = 1000; + for (int i=0; iisCached(i))==((i>=begin)&& (iindex(890, 0); //move buffer + cp->data(idx, Qt::DisplayRole); + begin = 830; + end = 950; + for (int i=0; iisCached(i))==((i>=begin)&& (iindex(10, 0); //move buffer + cp->data(idx, Qt::DisplayRole); + begin = 0; + end = 120; + for (int i=0; iisCached(i))==((i>=begin)&& (i