|
|
@@ -14,6 +14,7 @@
|
|
|
#include "game/graphics/vertex.h"
|
|
|
#include "game/math/shape.hpp"
|
|
|
#include "matrix/matrix.hpp"
|
|
|
+#include "matrix/matrix_helpers.hpp"
|
|
|
|
|
|
using testing::_;
|
|
|
using testing::AnyNumber;
|
|
|
@@ -61,8 +62,9 @@ TEST_F(DirectRendererTest, DrawPassesToDraw) {
|
|
|
renderer->draw(cast(1), math::matr4(), {});
|
|
|
}
|
|
|
|
|
|
-TEST_F(DirectRendererTest, DrawObjectHasEmptyTranslation) {
|
|
|
- EXPECT_CALL(*mock, draw(cast(1), math::matr4(), _)).Times(1);
|
|
|
+TEST_F(DirectRendererTest, DrawObjectHasIdenTranslation) {
|
|
|
+ auto identity = math::matrix::identity<float, 4>();
|
|
|
+ EXPECT_CALL(*mock, draw(cast(1), identity, _)).Times(1);
|
|
|
renderer->draw(DemoObject());
|
|
|
}
|
|
|
|
|
|
@@ -108,8 +110,8 @@ void BatchRendererTest::TearDown() {
|
|
|
delete mock;
|
|
|
}
|
|
|
|
|
|
-TEST_F(BatchRendererTest, CallsFlushOnDestructor) {
|
|
|
- EXPECT_CALL(*mock, flush()).Times(1);
|
|
|
+TEST_F(BatchRendererTest, DoesNotCallFlushOnDestructor) {
|
|
|
+ EXPECT_CALL(*mock, flush()).Times(0);
|
|
|
renderer.reset();
|
|
|
testing::Mock::VerifyAndClearExpectations(mock);
|
|
|
}
|
|
|
@@ -120,10 +122,8 @@ TEST_F(BatchRendererTest, ClearPassesToClear) {
|
|
|
renderer->clear();
|
|
|
}
|
|
|
|
|
|
-TEST_F(BatchRendererTest, FlushPassesToFlush) {
|
|
|
- EXPECT_CALL(*mock, flush()).Times(AnyNumber());
|
|
|
- // This will end up changing
|
|
|
- EXPECT_CALL(*mock, flush()).Times(1).RetiresOnSaturation();
|
|
|
+TEST_F(BatchRendererTest, FlushDoesNotPassToFlush) {
|
|
|
+ EXPECT_CALL(*mock, flush()).Times(0);
|
|
|
renderer->flush();
|
|
|
}
|
|
|
|
|
|
@@ -148,6 +148,8 @@ TEST_F(BatchRendererTest, GroupsDataTogetherByMaterial) {
|
|
|
TEST_F(BatchRendererTest, BatchLimitingCanSplitTheWrites) {
|
|
|
EXPECT_CALL(*mock, flush()).Times(AnyNumber());
|
|
|
renderer.reset(new graphics::batch_renderer(drenderer.get(), 15));
|
|
|
+ // This sometimes occurs...
|
|
|
+ EXPECT_CALL(*mock, draw(_, _, SizeIs(0))).Times(AnyNumber());
|
|
|
EXPECT_CALL(*mock, draw(cast(1), _, SizeIs(12))).Times(1);
|
|
|
EXPECT_CALL(*mock, draw(cast(2), _, SizeIs(6))).Times(2);
|
|
|
renderer->draw(DemoObject());
|