comparison tests/libclient/js-image/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 7f7c2607ace3
children a1e80d991968
comparison
equal deleted inserted replaced
26:56cc058200b5 27:0a1adf7dcca0
46 46
47 loadMalikaniaImage(m_ctx); 47 loadMalikaniaImage(m_ctx);
48 loadMalikaniaWindow(m_ctx); 48 loadMalikaniaWindow(m_ctx);
49 49
50 /* Store the loader */ 50 /* Store the loader */
51 duk::putGlobal(m_ctx, "\xff""\xff""loader", duk::RawPointer<ClientResourcesLoader>{&m_loader}); 51 duk::putGlobal(m_ctx, "\xff""\xff""loader", &m_loader);
52 } 52 }
53 }; 53 };
54 54
55 TEST_F(TestImage, size) 55 TEST_F(TestImage, size)
56 { 56 {
60 "w = i.size.width;" 60 "w = i.size.width;"
61 "h = i.size.height;" 61 "h = i.size.height;"
62 ); 62 );
63 63
64 if (ret != 0) { 64 if (ret != 0) {
65 throw duk::error(m_ctx, -1); 65 throw duk::exception(m_ctx, -1);
66 } 66 }
67 67
68 ASSERT_EQ(32, duk::getGlobal<int>(m_ctx, "w")); 68 ASSERT_EQ(32, duk::getGlobal<int>(m_ctx, "w"));
69 ASSERT_EQ(32, duk::getGlobal<int>(m_ctx, "h")); 69 ASSERT_EQ(32, duk::getGlobal<int>(m_ctx, "h"));
70 } catch (const std::exception &ex) { 70 } catch (const std::exception &ex) {
83 "i.draw(w, { x: 320 - 16, y: 240 - 16 });" 83 "i.draw(w, { x: 320 - 16, y: 240 - 16 });"
84 "w.present();" 84 "w.present();"
85 ); 85 );
86 86
87 if (ret != 0) { 87 if (ret != 0) {
88 throw duk::error(m_ctx, -1); 88 throw duk::exception(m_ctx, -1);
89 } 89 }
90 90
91 std::this_thread::sleep_for(3s); 91 std::this_thread::sleep_for(3s);
92 } catch (const std::exception &ex) { 92 } catch (const std::exception &ex) {
93 FAIL() << ex.what(); 93 FAIL() << ex.what();
105 "i.draw(w, null, { x: 10, y: 10, width: 620, height: 460 });" 105 "i.draw(w, null, { x: 10, y: 10, width: 620, height: 460 });"
106 "w.present();" 106 "w.present();"
107 ); 107 );
108 108
109 if (ret != 0) { 109 if (ret != 0) {
110 throw duk::error(m_ctx, -1); 110 throw duk::exception(m_ctx, -1);
111 } 111 }
112 112
113 std::this_thread::sleep_for(3s); 113 std::this_thread::sleep_for(3s);
114 } catch (const std::exception &ex) { 114 } catch (const std::exception &ex) {
115 FAIL() << ex.what(); 115 FAIL() << ex.what();