Example SConstruct for googletest + tip on UI tests

This slots into a project based on hello_openc

from scons_symbian import *

target     = "googletest_main"
targettype = "exe"
libraries  = ['libstdcpp', 'libc', 'euser']

# Static libs
staticlibs = ['libcrt0.lib']

uid3 = 0xA0001314

sources = ['../src/googletest_main.cpp',
           '../../../third_party/googletest/src/gtest-all.cc',
           '../../../third_party/googletest/test/gtest_unittest.cc']

includes    = ['../data', '../inc', '../../../third_party/googletest', '../../..']
sysincludes = [
  join(EPOC32_INCLUDE, "stdapis"),
  join(EPOC32_INCLUDE, "stdapis/stlport"),
  '../../../third_party/googletest/include'
]
defines     = ['_STLP_NO_WCHAR_T']

SymbianProgram( target, targettype,
    sources = sources,
    includes    = includes,
    sysincludes = sysincludes,
    libraries   = staticlibs+libraries,
    defines     = defines,
    epocstacksize = 8192,
    epocheapsize  = (0x1000,0x100000),
    uid3 = uid3,
    resources = [ "../data/googletest_main_reg.rss" ]
)

BTW, for running tests that use UI in the emulator you want to wait for the emulator to start up some more than it has by the time you hit your main(). Use something like

void WaitForMenuExe() {
#ifdef __WINS__
  scoped_ptr<TFullName> fulln(new TFullName);
  TUint32 menu_uid = 0x101f4cd2;
  while(true) {
    TFindProcess find;
    while (find.Next(*fulln) == KErrNone) {
      RProcess p;
      p.Open(find);
      if (p.SecureId().iId == menu_uid) {
        p.Close();
        return;
      }
      p.Close();
    }
    User::After(10 * 1000);
  }
#endif  // __WINS__
}
This entry was posted in Symbian. Bookmark the permalink.

Comments are closed.