diff 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
line wrap: on
line diff
--- a/tests/libclient/js-image/main.cpp	Tue Apr 05 21:06:27 2016 +0200
+++ b/tests/libclient/js-image/main.cpp	Wed Apr 06 13:17:33 2016 +0200
@@ -52,6 +52,26 @@
 	}
 };
 
+TEST_F(TestImage, size)
+{
+	try {
+		auto ret = duk::pevalString(m_ctx,
+			"i = new Malikania.Image('images/smiley.png');"
+			"w = i.size.width;"
+			"h = i.size.height;"
+		);
+
+		if (ret != 0) {
+			throw duk::error(m_ctx, -1);
+		}
+
+		ASSERT_EQ(32, duk::getGlobal<int>(m_ctx, "w"));
+		ASSERT_EQ(32, duk::getGlobal<int>(m_ctx, "h"));
+	} catch (const std::exception &ex) {
+		FAIL() << ex.what();
+	}
+}
+
 TEST_F(TestImage, basic)
 {
 	try {