Esempio n. 1
0
/* ****************************************************************************
*
* check - should Scope::check always return "OK"?
*/
TEST(Scope, check)
{
  Scope        scope;
  Scope        scope1("",     "value");
  Scope        scope2("type", "");
  Scope        scope3("type", "value");
  std::string  checked;
  std::string  expected  = "Empty type in restriction scope";
  std::string  expected1 = "Empty type in restriction scope";
  std::string  expected2 = "Empty value in restriction scope";
  std::string  expected3 = "OK";
  
  utInit();

  checked = scope.check(RegisterContext, XML, "", "", 0);
  EXPECT_STREQ(checked.c_str(), expected.c_str());

  checked = scope1.check(RegisterContext, XML, "", "", 0);
  EXPECT_STREQ(checked.c_str(), expected1.c_str());

  checked = scope2.check(RegisterContext, XML, "", "", 0);
  EXPECT_STREQ(checked.c_str(), expected2.c_str());

  checked = scope3.check(RegisterContext, XML, "", "", 0);
  EXPECT_STREQ(checked.c_str(), expected3.c_str());

  utExit();
}
Esempio n. 2
0
/* ****************************************************************************
*
* getAndSize - 
*/
TEST(ScopeVector, getAndSize)
{
  ScopeVector   sV;
  Scope         scope0("Type", "Value0");
  Scope         scope1("Type", "Value1");
  Scope         scope2("Type", "Value2");
  Scope*        scopeP;

  utInit();

  sV.push_back(&scope0);
  sV.push_back(&scope1);
  sV.push_back(&scope2);

  EXPECT_EQ(3, sV.size());

  scopeP = sV[0];
  EXPECT_STREQ("Value0", scopeP->value.c_str());

  scopeP = sV[1];
  EXPECT_STREQ("Value1", scopeP->value.c_str());

  scopeP = sV[2];
  EXPECT_STREQ("Value2", scopeP->value.c_str());

  utExit();
}
Esempio n. 3
0
int main() {
  scope1();
  scope2();
  scope3();
  scope4();
  scope5();
  return 0;
}
// reduce the size of tiles in order to hopefully use less memory overall
bool RenderCache::ReduceTileSize()
{
    if (maxTileSize.dx < 200 || maxTileSize.dy < 200)
        return false;

    ScopedCritSec scope1(&requestAccess);
    ScopedCritSec scope2(&cacheAccess);

    if (maxTileSize.dx > maxTileSize.dy)
        (int)maxTileSize.dx /= 2;
    else
        (int)maxTileSize.dy /= 2;

    // invalidate all rendered bitmaps and all requests
    while (cacheCount > 0)
        FreeForDisplayModel(cache[0]->dm);
    while (requestCount > 0)
        ClearQueueForDisplayModel(requests[0].dm);
    AbortCurrentRequest();

    return true;
}