Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: sky/engine/core/animation/EffectInputTest.cpp

Issue 922893002: Merge the Sky Engine changes from the SkyDart branch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/animation/EffectInput.cpp ('k') | sky/engine/core/animation/ElementAnimation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/animation/EffectInputTest.cpp
diff --git a/sky/engine/core/animation/EffectInputTest.cpp b/sky/engine/core/animation/EffectInputTest.cpp
deleted file mode 100644
index dd26c6e7749bf9bc38f49086830ec4e14916d2d1..0000000000000000000000000000000000000000
--- a/sky/engine/core/animation/EffectInputTest.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sky/engine/config.h"
-#include "sky/engine/core/animation/EffectInput.h"
-
-#include <gtest/gtest.h>
-
-#include "sky/engine/bindings/core/v8/Dictionary.h"
-#include "sky/engine/core/animation/AnimationTestHelper.h"
-#include "sky/engine/core/animation/KeyframeEffectModel.h"
-#include "sky/engine/core/dom/Document.h"
-#include "sky/engine/core/dom/Element.h"
-#include "v8/include/v8.h"
-
-using namespace blink;
-
-namespace {
-
-class AnimationEffectInputTest : public ::testing::Test {
-protected:
- AnimationEffectInputTest()
- : document(Document::create())
- , element(document->createElement("foo", ASSERT_NO_EXCEPTION))
- , m_isolate(v8::Isolate::GetCurrent())
- , m_scope(m_isolate)
- {
- }
-
- RefPtr<Document> document;
- RefPtr<Element> element;
- TrackExceptionState exceptionState;
- v8::Isolate* m_isolate;
-
-private:
- V8TestingScope m_scope;
-};
-
-TEST_F(AnimationEffectInputTest, SortedOffsets)
-{
- Vector<Dictionary> jsKeyframes;
- v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate);
-
- setV8ObjectPropertyAsString(keyframe1, "width", "100px");
- setV8ObjectPropertyAsString(keyframe1, "offset", "0");
- setV8ObjectPropertyAsString(keyframe2, "width", "0px");
- setV8ObjectPropertyAsString(keyframe2, "offset", "1");
-
- jsKeyframes.append(Dictionary(keyframe1, m_isolate));
- jsKeyframes.append(Dictionary(keyframe2, m_isolate));
-
- RefPtr<AnimationEffect> animationEffect = EffectInput::convert(element.get(), jsKeyframes, exceptionState);
- EXPECT_FALSE(exceptionState.hadException());
- const KeyframeEffectModelBase& keyframeEffect = *toKeyframeEffectModelBase(animationEffect.get());
- EXPECT_EQ(1.0, keyframeEffect.getFrames()[1]->offset());
-}
-
-TEST_F(AnimationEffectInputTest, UnsortedOffsets)
-{
- Vector<Dictionary> jsKeyframes;
- v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate);
-
- setV8ObjectPropertyAsString(keyframe1, "width", "0px");
- setV8ObjectPropertyAsString(keyframe1, "offset", "1");
- setV8ObjectPropertyAsString(keyframe2, "width", "100px");
- setV8ObjectPropertyAsString(keyframe2, "offset", "0");
-
- jsKeyframes.append(Dictionary(keyframe1, m_isolate));
- jsKeyframes.append(Dictionary(keyframe2, m_isolate));
-
- EffectInput::convert(element.get(), jsKeyframes, exceptionState);
- EXPECT_TRUE(exceptionState.hadException());
- EXPECT_EQ(InvalidModificationError, exceptionState.code());
-}
-
-TEST_F(AnimationEffectInputTest, LooslySorted)
-{
- Vector<Dictionary> jsKeyframes;
- v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe3 = v8::Object::New(m_isolate);
-
- setV8ObjectPropertyAsString(keyframe1, "width", "100px");
- setV8ObjectPropertyAsString(keyframe1, "offset", "0");
- setV8ObjectPropertyAsString(keyframe2, "width", "200px");
- setV8ObjectPropertyAsString(keyframe3, "width", "0px");
- setV8ObjectPropertyAsString(keyframe3, "offset", "1");
-
- jsKeyframes.append(Dictionary(keyframe1, m_isolate));
- jsKeyframes.append(Dictionary(keyframe2, m_isolate));
- jsKeyframes.append(Dictionary(keyframe3, m_isolate));
-
- RefPtr<AnimationEffect> animationEffect = EffectInput::convert(element.get(), jsKeyframes, exceptionState);
- EXPECT_FALSE(exceptionState.hadException());
- const KeyframeEffectModelBase& keyframeEffect = *toKeyframeEffectModelBase(animationEffect.get());
- EXPECT_EQ(1, keyframeEffect.getFrames()[2]->offset());
-}
-
-TEST_F(AnimationEffectInputTest, OutOfOrderWithNullOffsets)
-{
- Vector<Dictionary> jsKeyframes;
- v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe3 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe4 = v8::Object::New(m_isolate);
-
- setV8ObjectPropertyAsString(keyframe1, "height", "100px");
- setV8ObjectPropertyAsString(keyframe1, "offset", "0.5");
- setV8ObjectPropertyAsString(keyframe2, "height", "150px");
- setV8ObjectPropertyAsString(keyframe3, "height", "200px");
- setV8ObjectPropertyAsString(keyframe3, "offset", "0");
- setV8ObjectPropertyAsString(keyframe4, "height", "300px");
- setV8ObjectPropertyAsString(keyframe4, "offset", "1");
-
- jsKeyframes.append(Dictionary(keyframe1, m_isolate));
- jsKeyframes.append(Dictionary(keyframe2, m_isolate));
- jsKeyframes.append(Dictionary(keyframe3, m_isolate));
- jsKeyframes.append(Dictionary(keyframe4, m_isolate));
-
- EffectInput::convert(element.get(), jsKeyframes, exceptionState);
- EXPECT_TRUE(exceptionState.hadException());
-}
-
-TEST_F(AnimationEffectInputTest, Invalid)
-{
- // Not loosely sorted by offset, and there exists a keyframe with null offset.
- Vector<Dictionary> jsKeyframes;
- v8::Handle<v8::Object> keyframe1 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe2 = v8::Object::New(m_isolate);
- v8::Handle<v8::Object> keyframe3 = v8::Object::New(m_isolate);
-
- setV8ObjectPropertyAsString(keyframe1, "width", "0px");
- setV8ObjectPropertyAsString(keyframe1, "offset", "1");
- setV8ObjectPropertyAsString(keyframe2, "width", "200px");
- setV8ObjectPropertyAsString(keyframe3, "width", "100px");
- setV8ObjectPropertyAsString(keyframe3, "offset", "0");
-
- jsKeyframes.append(Dictionary(keyframe1, m_isolate));
- jsKeyframes.append(Dictionary(keyframe2, m_isolate));
- jsKeyframes.append(Dictionary(keyframe3, m_isolate));
-
- EffectInput::convert(element.get(), jsKeyframes, exceptionState);
- EXPECT_TRUE(exceptionState.hadException());
- EXPECT_EQ(InvalidModificationError, exceptionState.code());
-}
-
-}
« no previous file with comments | « sky/engine/core/animation/EffectInput.cpp ('k') | sky/engine/core/animation/ElementAnimation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698