|
|
@@ -9,6 +9,7 @@
|
|
|
#include <gmock/gmock.h>
|
|
|
|
|
|
#include "../src/helper.hpp"
|
|
|
+#include "game/graphics/exception.h"
|
|
|
#include "game/graphics/manager.hpp"
|
|
|
#include "game/graphics/material.hpp"
|
|
|
#include "game/graphics/shader.hpp"
|
|
|
@@ -135,13 +136,25 @@ TEST_F(TextureTest, SizeOfTexturePassedIntoCompile) {
|
|
|
mock.get("resources/black2.bmp");
|
|
|
}
|
|
|
|
|
|
+TEST_F(TextureTest, CanReadRGBFormat) {
|
|
|
+ using graphics::textures::format;
|
|
|
+ EXPECT_CALL(mock, compile(format::RGB, make_vector(1, 1), _)).Times(1);
|
|
|
+ mock.get("resources/black_rgb.png");
|
|
|
+}
|
|
|
+
|
|
|
+TEST_F(TextureTest, CanReadRGBAFormat) {
|
|
|
+ using graphics::textures::format;
|
|
|
+ EXPECT_CALL(mock, compile(format::RGBA, make_vector(1, 1), _)).Times(1);
|
|
|
+ mock.get("resources/black_rgba.png");
|
|
|
+}
|
|
|
+
|
|
|
using MaterialTest = ManagerTest;
|
|
|
|
|
|
-// TEST_F(MaterialTest, ThrowsExceptionIfNoTexOrUniform) {
|
|
|
-// EXPECT_CALL(mock, compile(_, _, _)).Times(AnyNumber());
|
|
|
-// // TODO (sjaffe): Throw a specific exception here, since throw; kills us
|
|
|
-// EXPECT_ANY_THROW(mock.get(cast_p(1), "", ""));
|
|
|
-//}
|
|
|
+TEST_F(MaterialTest, ThrowsExceptionIfNoTexOrUniform) {
|
|
|
+ EXPECT_CALL(mock, compile(_, _, _)).Times(AnyNumber());
|
|
|
+ EXPECT_THROW(mock.get(cast_p(1), "", ""),
|
|
|
+ graphics::unmapped_enum<graphics::materials::uniform>);
|
|
|
+}
|
|
|
|
|
|
TEST_F(MaterialTest, GeneratesUniformTexturesIfNoTexFile) {
|
|
|
using graphics::materials::uniform;
|