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

Unified Diff: client/tests/client/touch/touch_tests.dart

Issue 8341003: Get touch tests working at all, and with new API. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Mark test as skipped instead of commenting out. Created 9 years, 2 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 | « client/tests/client/touch/TouchTests.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/tests/client/touch/touch_tests.dart
diff --git a/client/tests/client/touch/touch_tests.dart b/client/tests/client/touch/touch_tests.dart
new file mode 100644
index 0000000000000000000000000000000000000000..60fb82e6ca4142325ac526f4b10093a4ea502a08
--- /dev/null
+++ b/client/tests/client/touch/touch_tests.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#library('touch_tests');
+
+#import('dart:html'); // TODO(rnystrom): Only needed to tell architecture.py
+ // that this is a web test. Come up with cleaner solution.
+#import('../../../testing/unittest/unittest.dart');
+#import('../../../touch/touch.dart');
+
+main() {
+ test('Solver', () {
+ expect(Solver.solve((x) => x * x, 81, 10)).approxEquals(9);
+ expect(Solver.solve((x) => x * x, 0, 10)).approxEquals(0);
+ expect(Solver.solve((x) => x * x, 1.5625, 10)).approxEquals(1.25);
+ expect(Solver.solve((x) => 1 / x, 10, 1)).approxEquals(0.1);
+ });
+
+ group('Momentum', () {
+ test('SingleDimensionPhysics', () {
+ expect(new SingleDimensionPhysics().solve(0, 0, 1)).equals(0);
+ expect(new SingleDimensionPhysics().solve(0, 5, 1)).equals(0);
+ expect(new SingleDimensionPhysics().solve(0, 100, 1)).equals(0);
+ expect(new SingleDimensionPhysics().solve(0, 100, 0.5)).equals(0);
+ });
+
+ test('TimeoutMomentum()', () {
+ final delegate = new TestMomentumDelegate();
+ final momentum = new TimeoutMomentum(null);
+ });
+ });
+}
+
+class TestMomentumDelegate {
+ Function onDecelerateCallback;
+ Function onDecelerationEndCallback;
+
+ void onDecelerate(num x, num y,
+ [num duration = 0, String timingFunction = null]) {
+ onDecelerateCallback(x, y, duration, timingFunction);
+ }
+
+ /**
+ * Callback for end of deceleration.
+ */
+ void onDecelerationEnd() {
+ onDecelerationEndCallback();
+ }
+}
« no previous file with comments | « client/tests/client/touch/TouchTests.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698