diff tests/libclient/js-sprite/main.cpp @ 30:a1e80d991968

Misc: convert to spaces, #519
author David Demelier <markand@malikania.fr>
date Thu, 16 Jun 2016 13:35:31 +0200
parents 0a1adf7dcca0
children d4f5f7231b84
line wrap: on
line diff
--- a/tests/libclient/js-sprite/main.cpp	Thu May 26 07:32:05 2016 +0200
+++ b/tests/libclient/js-sprite/main.cpp	Thu Jun 16 13:35:31 2016 +0200
@@ -33,158 +33,158 @@
 
 class TestSprite : public testing::Test {
 protected:
-	ResourcesLocatorDirectory m_locator;
-	ClientResourcesLoader m_loader;
+    ResourcesLocatorDirectory m_locator;
+    ClientResourcesLoader m_loader;
 
-	duk::Context m_ctx;
+    duk::Context m_ctx;
 
 public:
-	TestSprite()
-		: m_locator(SOURCE_DIRECTORY "/resources")
-		, m_loader(m_locator)
-	{
-		duk::putGlobal(m_ctx, "Malikania", duk::Object());
+    TestSprite()
+        : m_locator(SOURCE_DIRECTORY "/resources")
+        , m_loader(m_locator)
+    {
+        duk::putGlobal(m_ctx, "Malikania", duk::Object());
 
-		loadMalikaniaImage(m_ctx);
-		loadMalikaniaSprite(m_ctx);
-		loadMalikaniaWindow(m_ctx);
+        loadMalikaniaImage(m_ctx);
+        loadMalikaniaSprite(m_ctx);
+        loadMalikaniaWindow(m_ctx);
 
-		/* Store the loader */
-		duk::putGlobal(m_ctx, "\xff""\xff""loader", &m_loader);
-	}
+        /* Store the loader */
+        duk::putGlobal(m_ctx, "\xff""\xff""loader", &m_loader);
+    }
 };
 
 TEST_F(TestSprite, cell)
 {
-	try {
-		auto ret = duk::pevalString(m_ctx,
-			"s = new Malikania.Sprite('sprites/margins.json');"
-			"w = s.cell.width;"
-			"h = s.cell.height;"
-		);
+    try {
+        auto ret = duk::pevalString(m_ctx,
+            "s = new Malikania.Sprite('sprites/margins.json');"
+            "w = s.cell.width;"
+            "h = s.cell.height;"
+        );
 
-		if (ret != 0) {
-			throw duk::exception(m_ctx, -1);
-		}
+        if (ret != 0) {
+            throw duk::exception(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();
-	}
+        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(TestSprite, columns)
 {
-	try {
-		auto ret = duk::pevalString(m_ctx,
-			"s = new Malikania.Sprite('sprites/margins.json');"
-			"n = s.columns;"
-		);
+    try {
+        auto ret = duk::pevalString(m_ctx,
+            "s = new Malikania.Sprite('sprites/margins.json');"
+            "n = s.columns;"
+        );
 
-		if (ret != 0) {
-			throw duk::exception(m_ctx, -1);
-		}
+        if (ret != 0) {
+            throw duk::exception(m_ctx, -1);
+        }
 
-		ASSERT_EQ(4, duk::getGlobal<int>(m_ctx, "n"));
-	} catch (const std::exception &ex) {
-		FAIL() << ex.what();
-	}
+        ASSERT_EQ(4, duk::getGlobal<int>(m_ctx, "n"));
+    } catch (const std::exception &ex) {
+        FAIL() << ex.what();
+    }
 }
 
 TEST_F(TestSprite, margins)
 {
-	try {
-		auto ret = duk::pevalString(m_ctx,
-			"s = new Malikania.Sprite('sprites/margins.json');"
-			"w = s.margins.width;"
-			"h = s.margins.height;"
-		);
+    try {
+        auto ret = duk::pevalString(m_ctx,
+            "s = new Malikania.Sprite('sprites/margins.json');"
+            "w = s.margins.width;"
+            "h = s.margins.height;"
+        );
 
-		if (ret != 0) {
-			throw duk::exception(m_ctx, -1);
-		}
+        if (ret != 0) {
+            throw duk::exception(m_ctx, -1);
+        }
 
-		ASSERT_EQ(4, duk::getGlobal<int>(m_ctx, "w"));
-		ASSERT_EQ(6, duk::getGlobal<int>(m_ctx, "h"));
-	} catch (const std::exception &ex) {
-		FAIL() << ex.what();
-	}
+        ASSERT_EQ(4, duk::getGlobal<int>(m_ctx, "w"));
+        ASSERT_EQ(6, duk::getGlobal<int>(m_ctx, "h"));
+    } catch (const std::exception &ex) {
+        FAIL() << ex.what();
+    }
 }
 
 TEST_F(TestSprite, rows)
 {
-	try {
-		auto ret = duk::pevalString(m_ctx,
-			"s = new Malikania.Sprite('sprites/margins.json');"
-			"n = s.rows;"
-		);
+    try {
+        auto ret = duk::pevalString(m_ctx,
+            "s = new Malikania.Sprite('sprites/margins.json');"
+            "n = s.rows;"
+        );
 
-		if (ret != 0) {
-			throw duk::exception(m_ctx, -1);
-		}
+        if (ret != 0) {
+            throw duk::exception(m_ctx, -1);
+        }
 
-		ASSERT_EQ(3, duk::getGlobal<int>(m_ctx, "n"));
-	} catch (const std::exception &ex) {
-		FAIL() << ex.what();
-	}
+        ASSERT_EQ(3, duk::getGlobal<int>(m_ctx, "n"));
+    } catch (const std::exception &ex) {
+        FAIL() << ex.what();
+    }
 }
 
 TEST_F(TestSprite, space)
 {
-	try {
-		auto ret = duk::pevalString(m_ctx,
-			"s = new Malikania.Sprite('sprites/margins.json');"
-			"w = s.space.width;"
-			"h = s.space.height;"
-		);
+    try {
+        auto ret = duk::pevalString(m_ctx,
+            "s = new Malikania.Sprite('sprites/margins.json');"
+            "w = s.space.width;"
+            "h = s.space.height;"
+        );
 
-		if (ret != 0) {
-			throw duk::exception(m_ctx, -1);
-		}
+        if (ret != 0) {
+            throw duk::exception(m_ctx, -1);
+        }
 
-		ASSERT_EQ(2, duk::getGlobal<int>(m_ctx, "w"));
-		ASSERT_EQ(3, duk::getGlobal<int>(m_ctx, "h"));
-	} catch (const std::exception &ex) {
-		FAIL() << ex.what();
-	}
+        ASSERT_EQ(2, duk::getGlobal<int>(m_ctx, "w"));
+        ASSERT_EQ(3, duk::getGlobal<int>(m_ctx, "h"));
+    } catch (const std::exception &ex) {
+        FAIL() << ex.what();
+    }
 }
 
 TEST_F(TestSprite, basic)
 {
-	try {
-		auto ret = duk::pevalString(m_ctx,
-			"w = new Malikania.Window();"
-			"s = new Malikania.Sprite('sprites/margins.json');"
-			"c = 0;"
-		);
+    try {
+        auto ret = duk::pevalString(m_ctx,
+            "w = new Malikania.Window();"
+            "s = new Malikania.Sprite('sprites/margins.json');"
+            "c = 0;"
+        );
 
-		if (ret != 0) {
-			throw duk::exception(m_ctx, -1);
-		}
+        if (ret != 0) {
+            throw duk::exception(m_ctx, -1);
+        }
 
-		for (unsigned c = 0; c < 12; ++c) {
-			auto ret = duk::pevalString(m_ctx,
-				"w.setDrawingColor('lightskyblue');"
-				"w.clear();"
-				"s.draw(w, c++, { x: 320 - 16, y: 240 - 16 });"
-				"w.present();"
-			);
+        for (unsigned c = 0; c < 12; ++c) {
+            auto ret = duk::pevalString(m_ctx,
+                "w.setDrawingColor('lightskyblue');"
+                "w.clear();"
+                "s.draw(w, c++, { x: 320 - 16, y: 240 - 16 });"
+                "w.present();"
+            );
 
-			if (ret != 0) {
-				throw duk::exception(m_ctx, -1);
-			}
+            if (ret != 0) {
+                throw duk::exception(m_ctx, -1);
+            }
 
-			std::this_thread::sleep_for(1s);
-		}
-	} catch (const std::exception &ex) {
-		FAIL() << ex.what();
-	}
+            std::this_thread::sleep_for(1s);
+        }
+    } catch (const std::exception &ex) {
+        FAIL() << ex.what();
+    }
 }
 
 int main(int argc, char **argv)
 {
-	testing::InitGoogleTest(&argc, argv);
+    testing::InitGoogleTest(&argc, argv);
 
-	return RUN_ALL_TESTS();
+    return RUN_ALL_TESTS();
 }