Mercurial > malikania
comparison tests/libclient/js-image/main.cpp @ 24:7f7c2607ace3
Client: add size property for Malikania.Image, #457
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 06 Apr 2016 13:17:33 +0200 |
parents | 6400830bb36b |
children | 0a1adf7dcca0 |
comparison
equal
deleted
inserted
replaced
23:ed63752a8720 | 24:7f7c2607ace3 |
---|---|
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", duk::RawPointer<ClientResourcesLoader>{&m_loader}); |
52 } | 52 } |
53 }; | 53 }; |
54 | 54 |
55 TEST_F(TestImage, size) | |
56 { | |
57 try { | |
58 auto ret = duk::pevalString(m_ctx, | |
59 "i = new Malikania.Image('images/smiley.png');" | |
60 "w = i.size.width;" | |
61 "h = i.size.height;" | |
62 ); | |
63 | |
64 if (ret != 0) { | |
65 throw duk::error(m_ctx, -1); | |
66 } | |
67 | |
68 ASSERT_EQ(32, duk::getGlobal<int>(m_ctx, "w")); | |
69 ASSERT_EQ(32, duk::getGlobal<int>(m_ctx, "h")); | |
70 } catch (const std::exception &ex) { | |
71 FAIL() << ex.what(); | |
72 } | |
73 } | |
74 | |
55 TEST_F(TestImage, basic) | 75 TEST_F(TestImage, basic) |
56 { | 76 { |
57 try { | 77 try { |
58 auto ret = duk::pevalString(m_ctx, | 78 auto ret = duk::pevalString(m_ctx, |
59 "w = new Malikania.Window();" | 79 "w = new Malikania.Window();" |