string Resolver::EnsureProject(const string &project) const { string project_id = FindProject(project); if (project_id == "") project_id = CreateProject(project); return project_id; }
//---------------------------------------------------------------------------- void GamePlayApp::WillEnterForeground (bool isFirstTime) { PX2_LOG_INFO("WillEnterForeground"); Application::WillEnterForeground(isFirstTime); if (isFirstTime) { CreateProject(); } }
TEST_FIXTURE(CacheDbVersionActionFixtureClass, EmptyCacheDbFiles) { CreateProject(AbsoluteDir(wxT("project_1"))); CHECK(Action.Init(Globals)); Action.BackgroundWork(); CHECK(Globals.TagCacheDbFileName.FileExists()); soci::session session(*soci::factory_sqlite3(), t4p::WxToChar(Globals.TagCacheDbFileName.GetFullPath())); bool greater = t4p::SqliteSchemaVersion(session) > 0; CHECK(greater); }
TEST_FIXTURE(CacheDbVersionActionFixtureClass, ExistingCacheDbFiles) { wxString error; CreateProject(AbsoluteDir(wxT("project_1"))); // create the db files soci::session session(*soci::factory_sqlite3(), t4p::WxToChar(Globals.TagCacheDbFileName.GetFullPath())); t4p::SqliteSqlScript(t4p::ResourceSqlSchemaAsset(), session, error); CHECK(Action.Init(Globals)); Action.BackgroundWork(); CHECK(Globals.TagCacheDbFileName.FileExists()); bool greater = t4p::SqliteSchemaVersion(session) > 0; CHECK(greater); }
TEST_FIXTURE(CacheDbVersionActionFixtureClass, OldCacheDbFiles) { wxString error; CreateProject(AbsoluteDir(wxT("project_1"))); // create the db files soci::session session(*soci::factory_sqlite3(), t4p::WxToChar(Globals.TagCacheDbFileName.GetFullPath())); t4p::SqliteSqlScript(t4p::ResourceSqlSchemaAsset(), session, error); // set the version to be an old one session.once << "DELETE FROM schema_version;"; session.once << "INSERT INTO schema_version (version_number) VALUES (0);"; CHECK_EQUAL(0, t4p::SqliteSchemaVersion(session)); CHECK(Action.Init(Globals)); Action.BackgroundWork(); CHECK(Globals.TagCacheDbFileName.FileExists()); // not sure why I have to close the connection in order for the test to work session.close(); session.open(*soci::factory_sqlite3(), t4p::WxToChar(Globals.TagCacheDbFileName.GetFullPath())); bool greater = t4p::SqliteSchemaVersion(session) > 0; CHECK(greater); }