--dump-instr=yes --simulate-hwpref=yes --simulate-wb=yes \
./blobs.profile
-test: blobs.test
+test: blobs.test $(ASSET_DEP)
@echo run: blobs.test
@./blobs.test
+headless-test: blobs.test
+ @echo run: blobs.test --headless
+ @./blobs.test --headless
+
coverage: blobs.cover
@echo run: blobs.cover
@./blobs.cover
rm -f $(BIN) cachegrind.out.* callgrind.out.*
rm -Rf build client-saves saves
-.PHONY: all release cover debug profile tests run gdb cachegrind callgrind test coverage codecov lint clean distclean
+.PHONY: all release cover debug profile tests run gdb cachegrind callgrind test headless-test coverage codecov lint clean distclean
-include $(DEP)
--- /dev/null
+#include "AssetTest.hpp"
+
+#include "app/Assets.hpp"
+#include "app/init.hpp"
+
+CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(blobs::app::test::AssetTest, "headed");
+
+
+namespace blobs {
+namespace app {
+namespace test {
+
+void AssetTest::setUp() {
+}
+
+void AssetTest::tearDown() {
+}
+
+
+void AssetTest::testLoadAll() {
+ Init init(true, 8);
+ Assets assets;
+
+ CPPUNIT_ASSERT_MESSAGE(
+ "no resources loaded",
+ assets.data.resources.Size() > 0
+ );
+ CPPUNIT_ASSERT_MESSAGE(
+ "no tile types loaded",
+ assets.data.resources.Size() > 0
+ );
+
+ CPPUNIT_ASSERT_MESSAGE(
+ "tile texture has no width",
+ assets.textures.tiles.Width() > 0
+ );
+ CPPUNIT_ASSERT_MESSAGE(
+ "tile texture has no height",
+ assets.textures.tiles.Height() > 0
+ );
+ CPPUNIT_ASSERT_MESSAGE(
+ "tile texture has no depth",
+ assets.textures.tiles.Depth() > 0
+ );
+
+ CPPUNIT_ASSERT_MESSAGE(
+ "skin texture has no width",
+ assets.textures.skins.Width() > 0
+ );
+ CPPUNIT_ASSERT_MESSAGE(
+ "skin texture has no height",
+ assets.textures.skins.Height() > 0
+ );
+ CPPUNIT_ASSERT_MESSAGE(
+ "skin texture has no depth",
+ assets.textures.skins.Depth() > 0
+ );
+
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "large font has wrong family",
+ std::string("DejaVu Sans"), std::string(assets.fonts.large.FamilyName())
+ );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "medium font has wrong family",
+ std::string("DejaVu Sans"), std::string(assets.fonts.medium.FamilyName())
+ );
+ CPPUNIT_ASSERT_EQUAL_MESSAGE(
+ "small font has wrong family",
+ std::string("DejaVu Sans"), std::string(assets.fonts.small.FamilyName())
+ );
+}
+
+}
+}
+}
+#include <cstring>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
using CppUnit::TextUi::TestRunner;
-int main(int, char **) {
- TestRunner runner;
- TestFactoryRegistry ®istry = TestFactoryRegistry::getRegistry();
- runner.addTest(registry.makeTest());
- runner.run();
+int main(int argc, char **argv) {
+ bool headless = false;
+ if (argc > 1 && std::strcmp(argv[1], "--headless") == 0) {
+ headless = true;
+ }
- return 0;
+ TestRunner runner;
+ {
+ TestFactoryRegistry ®istry = TestFactoryRegistry::getRegistry();
+ runner.addTest(registry.makeTest());
+ }
+ if (!headless) {
+ TestFactoryRegistry ®istry = TestFactoryRegistry::getRegistry("headed");
+ runner.addTest(registry.makeTest());
+ }
+ if (runner.run()) {
+ return 0;
+ } else {
+ return 1;
+ }
}