comparison tests/libclient/js-image/main.cpp @ 63:96ba0c5cf893

Misc: update duktape.hpp to new style
author David Demelier <markand@malikania.fr>
date Fri, 16 Dec 2016 16:11:24 +0100
parents f30c84b4b9ed
children
comparison
equal deleted inserted replaced
62:a0081be977b5 63:96ba0c5cf893
31 31
32 class test_image { 32 class test_image {
33 protected: 33 protected:
34 mlk::directory_resources_locator m_locator; 34 mlk::directory_resources_locator m_locator;
35 mlk::client_resources_loader m_loader; 35 mlk::client_resources_loader m_loader;
36 UniqueContext m_ctx; 36 dukx_context m_ctx;
37 37
38 public: 38 public:
39 test_image() 39 test_image()
40 : m_locator(SOURCE_DIRECTORY "/resources") 40 : m_locator(SOURCE_DIRECTORY "/resources")
41 , m_loader(m_locator) 41 , m_loader(m_locator)
58 "w = i.size.width;" 58 "w = i.size.width;"
59 "h = i.size.height;" 59 "h = i.size.height;"
60 ); 60 );
61 61
62 if (ret != 0) { 62 if (ret != 0) {
63 throw dukx_exception(m_ctx, -1); 63 throw dukx_get_exception(m_ctx, -1);
64 } 64 }
65 65
66 duk_get_global_string(m_ctx, "w"); 66 duk_get_global_string(m_ctx, "w");
67 BOOST_REQUIRE_EQUAL(32U, duk_to_uint(m_ctx, -1)); 67 BOOST_REQUIRE_EQUAL(32U, duk_to_uint(m_ctx, -1));
68 duk_pop(m_ctx); 68 duk_pop(m_ctx);
85 "i.draw(w, { x: 320 - 16, y: 240 - 16 });" 85 "i.draw(w, { x: 320 - 16, y: 240 - 16 });"
86 "w.present();" 86 "w.present();"
87 ); 87 );
88 88
89 if (ret != 0) { 89 if (ret != 0) {
90 throw dukx_exception(m_ctx, -1); 90 throw dukx_get_exception(m_ctx, -1);
91 } 91 }
92 92
93 std::this_thread::sleep_for(3s); 93 std::this_thread::sleep_for(3s);
94 } catch (const std::exception &ex) { 94 } catch (const std::exception &ex) {
95 BOOST_FAIL(ex.what()); 95 BOOST_FAIL(ex.what());
107 "i.draw(w, null, { x: 10, y: 10, width: 620, height: 460 });" 107 "i.draw(w, null, { x: 10, y: 10, width: 620, height: 460 });"
108 "w.present();" 108 "w.present();"
109 ); 109 );
110 110
111 if (ret != 0) { 111 if (ret != 0) {
112 throw dukx_exception(m_ctx, -1); 112 throw dukx_get_exception(m_ctx, -1);
113 } 113 }
114 114
115 std::this_thread::sleep_for(3s); 115 std::this_thread::sleep_for(3s);
116 } catch (const std::exception &ex) { 116 } catch (const std::exception &ex) {
117 BOOST_FAIL(ex.what()); 117 BOOST_FAIL(ex.what());