comparison tests/libclient/js-animation/main.cpp @ 27:0a1adf7dcca0

Common: update libjs and adapt code
author David Demelier <markand@malikania.fr>
date Tue, 12 Apr 2016 13:53:11 +0200
parents ed63752a8720
children a1e80d991968
comparison
equal deleted inserted replaced
26:56cc058200b5 27:0a1adf7dcca0
49 loadMalikaniaAnimation(m_ctx); 49 loadMalikaniaAnimation(m_ctx);
50 loadMalikaniaAnimator(m_ctx); 50 loadMalikaniaAnimator(m_ctx);
51 loadMalikaniaWindow(m_ctx); 51 loadMalikaniaWindow(m_ctx);
52 52
53 /* Store the loader */ 53 /* Store the loader */
54 duk::putGlobal(m_ctx, "\xff""\xff""loader", duk::RawPointer<ClientResourcesLoader>{&m_loader}); 54 duk::putGlobal(m_ctx, "\xff""\xff""loader", &m_loader);
55 } 55 }
56 }; 56 };
57 57
58 TEST_F(TestAnimation, basic) 58 TEST_F(TestAnimation, basic)
59 { 59 {
63 "a = new Malikania.Animation('animations/margins.json');" 63 "a = new Malikania.Animation('animations/margins.json');"
64 "d = new Malikania.Animator(a);" 64 "d = new Malikania.Animator(a);"
65 ); 65 );
66 66
67 if (ret != 0) { 67 if (ret != 0) {
68 throw duk::error(m_ctx, -1); 68 throw duk::exception(m_ctx, -1);
69 } 69 }
70 70
71 ElapsedTimer timer; 71 ElapsedTimer timer;
72 72
73 while (timer.elapsed() < 8000) { 73 while (timer.elapsed() < 8000) {
78 "d.update();" 78 "d.update();"
79 "w.present();" 79 "w.present();"
80 ); 80 );
81 81
82 if (ret != 0) { 82 if (ret != 0) {
83 throw duk::error(m_ctx, -1); 83 throw duk::exception(m_ctx, -1);
84 } 84 }
85 } 85 }
86 86
87 std::this_thread::sleep_for(3s); 87 std::this_thread::sleep_for(3s);
88 } catch (const std::exception &ex) { 88 } catch (const std::exception &ex) {