00001
00002
00003
00004
00005
00006
00007
00008 #ifndef TESTOGLIMAGECACHESTORE_H
00009 #define TESTOGLIMAGECACHESTORE_H
00010
00011 #define BOOST_TEST_MODULE MediaTableTestSuite
00012 #include "boost/test/unit_test.hpp"
00013
00014 #include "../OglImageCacheStore.h"
00015
00016 #include "Visualization/RgbOglImage.h"
00017
00018 #include "Basis/Quid.h"
00019
00020 typedef Impala::Application::MediaTable::OglImageCacheStore OglImageCacheStore;
00021
00022 BOOST_AUTO_TEST_SUITE(OglImageCacheStoreTests)
00023
00024 struct OglImageCacheStoreFixture : public TableDataSourceFixture {
00025 OglImageCacheStoreFixture() {
00026 store = OglImageCacheStore::GetInstance();
00027 }
00028 ~OglImageCacheStoreFixture() {
00029 OglImageCacheStore::GetInstance()->Clear();
00030 }
00031
00032 OglImageCacheStore* store;
00033 };
00034
00035 BOOST_FIXTURE_TEST_CASE(testOglImageCacheStoreRemove, OglImageCacheStoreFixture) {
00036 }
00037
00038 BOOST_FIXTURE_TEST_CASE(OglImageCacheStoreTest, OglImageCacheStoreFixture) {
00039 BOOST_REQUIRE(store);
00040
00041 OGLIMAGE* img = oglSys.OglImage(GL_RGB, 0, 0);
00042 BOOST_CHECK(!store->GetImage(1));
00043 BOOST_REQUIRE(img);
00044 store->Add(img, 1);
00045 BOOST_CHECK_EQUAL(store->GetImage(1), img);
00046
00047 for(int i=2; i < 100; i++) {
00048 store->Add(oglSys.OglImage(GL_RGB, 0, 0), i);
00049 }
00050 BOOST_CHECK_EQUAL(store->GetImage(1), img);
00051 }
00052
00053 BOOST_FIXTURE_TEST_CASE(OglImageCacheStoreQuidTest, OglImageCacheStoreFixture) {
00054 BOOST_REQUIRE(src);
00055
00056 BOOST_REQUIRE(store);
00057
00058 BOOST_CHECK_EQUAL(Impala::QuidClass(src->GetQuid("id", 1)), 0);
00059 BOOST_CHECK_EQUAL(Impala::QuidSet(src->GetQuid("id", 1)), TableDataSource::TYPE_INT);
00060 BOOST_CHECK_EQUAL(Impala::QuidObject(src->GetQuid("id", 1)), 1);
00061 BOOST_CHECK_EQUAL(Impala::QuidId(src->GetQuid("id", 1)), 1);
00062 BOOST_CHECK_EQUAL(Impala::QuidId(src->GetQuid("id", 2)), 2);
00063
00064 BOOST_CHECK_EQUAL(src->GetQuid("id", 1), Impala::MakeQuid(0, TableDataSource::TYPE_INT, 1, 1));
00065 BOOST_CHECK_EQUAL(src->GetQuid("red", 2), Impala::MakeQuid(0, TableDataSource::TYPE_NORMALIZEDVALUE, 2, 2));
00066 BOOST_CHECK_EQUAL(src->GetQuid("green", 3), Impala::MakeQuid(0, TableDataSource::TYPE_NORMALIZEDVALUE, 3, 3));
00067 BOOST_CHECK_EQUAL(src->GetQuid("blue", 4), Impala::MakeQuid(0, TableDataSource::TYPE_NORMALIZEDVALUE, 4, 4));
00068
00069 for(int i=0; i < 100; i++)
00070 BOOST_CHECK_EQUAL((long) src->GetQuid("id", i), i);
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 }
00088
00089 BOOST_AUTO_TEST_SUITE_END()
00090
00091 #endif