emscripten Humble Cloud interface
Edward Rudd
2014-10-02 bcdee4665ca03e056cd5c9df2bc744b9c2da3898

add in tests for demo end functionality

3 files modified
15 ■■■■ changed files
client/CMakeLists.txt 2 ●●● patch | view | raw | blame | history
client/test/main.cpp 7 ●●●●● patch | view | raw | blame | history
client/test/shell.html 6 ●●●● patch | view | raw | blame | history
client/CMakeLists.txt
@@ -30,7 +30,7 @@
    ../humble_cloud/urkle_cloud.js
ASM_FLAG
    NO_EXIT_RUNTIME=1
    EXPORTED_FUNCTIONS="['_main','_test_list_files','_test_async_fetch']"
    EXPORTED_FUNCTIONS="['_main','_test_list_files','_test_async_fetch','_test_demo_end']"
PRE_JS
    ${TEST_DATA}
JS_LIBS
client/test/main.cpp
@@ -9,6 +9,7 @@
extern "C" {
    void test_list_files();
    void test_async_fetch(const char* url);
    void test_demo_end();
}
std::string userDataPath = "/user_data";
@@ -63,6 +64,12 @@
    humble_fetch_asset_data(url, NULL, on_get_file, on_fail_file);
}
void test_demo_end()
{
    std::cout << "Demo has ended\n";
    humble_demo_ended();
}
int main(int argc, char * argv[])
{
    std::cout << "Welcome Main\n";
client/test/shell.html
@@ -1210,6 +1210,7 @@
    <div class="emscripten_border">
      <span class="controls">
         <span><input type="button" value="List Files" onclick="call_test_function('test_list_files')"></span>
         <span><input type="button" value="End Demo" onclick="call_test_function('test_demo_end')"></span>
         <span><input type="button" value="Fetch from Cloud" onclick="fetch_from_cloud()"></span>
         <span><input type="button" value="Push to Cloud" onclick="push_to_cloud()"></span>
         <span><input type="button" value="Populate local data" onclick="populate_user_data()"></span>
@@ -1305,12 +1306,15 @@
          HUMBLE_API.configure({
              applicationtoken: 'deadbeef',
              buildCacheKey: function(path) {
                  return path;
                  return { path: path, scope: this.options.applicationtoken };
              },
              playerSize: function() {
                  return {
                      width: 800, height: 600, locked: true
                  }
              },
              demoEndedCallback: function() {
                  alert('We be done');
              }
          });
      });