summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-07-07 16:29:34 +0200
committerKonstantin Käfer <mail@kkaefer.com>2016-07-07 16:29:34 +0200
commit2e10c0a8660af9cdf6ff897aaa39e15fe62c6582 (patch)
tree92ad442bd0b54fcb16317e77c5a3a45213a16145 /test
parentab1face71f62752d49a0d25f8bc22fe142c7cdee (diff)
downloadqtlocation-mapboxgl-2e10c0a8660af9cdf6ff897aaa39e15fe62c6582.tar.gz
[core] don't force GL state to be set when calling .reset()
We are using Value::reset() to change a piece of GL state to its default value. However, the current implementation always executes the GL call, even if our state tracking system knows that it's already at that value. The new implementation of Value::reset() now respects that, resulting in a lot fewer GL calls.
Diffstat (limited to 'test')
-rw-r--r--test/gl/object.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/test/gl/object.cpp b/test/gl/object.cpp
index 5e7a158939..1506c33956 100644
--- a/test/gl/object.cpp
+++ b/test/gl/object.cpp
@@ -18,11 +18,13 @@ static bool setFlag = false;
struct MockGLObject {
using Type = bool;
- static const Type Default = false;
+ static const Type Default;
static Type Get() { getFlag = true; return true; }
static void Set(const Type&) { setFlag = true; }
};
+const bool MockGLObject::Default = false;
+
TEST(GLObject, Preserve) {
getFlag = false;
setFlag = false;
@@ -61,7 +63,7 @@ TEST(GLObject, Value) {
object->reset();
EXPECT_EQ(object->getCurrent(), false);
- EXPECT_TRUE(object->getDirty());
+ EXPECT_FALSE(object->getDirty());
EXPECT_TRUE(setFlag);
}