2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
22 #include <dali/public-api/dali-core.h>
24 #include <dali-test-suite-utils.h>
27 using namespace Dali::Internal;
31 static void Startup();
32 static void Cleanup();
35 void (*tet_startup)() = Startup;
36 void (*tet_cleanup)() = Cleanup;
39 static void utcDaliSplineGetKnot01();
40 static void utcDaliSplineGetKnot02();
41 static void utcDaliSplineGetKnot03();
42 static void utcDaliSplineGetOutTangent01();
43 static void utcDaliSplineGetOutTangent02();
44 static void utcDaliSplineGetOutTangent03();
45 static void utcDaliSplineGetInTangent01();
46 static void utcDaliSplineGetInTangent02();
47 static void utcDaliSplineGetInTangent03();
48 static void utcDaliSplineGenerateControlPoints01();
49 static void utcDaliSplineGenerateControlPoints02();
50 static void utcDaliSplineGenerateControlPoints03();
52 static void UtcDaliSplineGetYFromMonotonicX();
53 static void UtcDaliSplineGetY01();
54 static void UtcDaliSplineGetY02();
55 static void UtcDaliSplineGetY02b();
56 static void UtcDaliSplineGetY03();
57 static void UtcDaliSplineGetY04();
58 static void UtcDaliSplineGetY04b();
59 static void UtcDaliSplineGetPoint01();
60 static void UtcDaliSplineGetPoint02();
61 static void UtcDaliSplineGetPoint03();
62 static void UtcDaliSplineGetPoint04();
63 static void UtcDaliSplineGetPoint05();
64 static void UtcDaliSplineGetPoint06();
68 POSITIVE_TC_IDX = 0x01,
72 // Add test functionality for all APIs in the class (Positive and Negative)
74 struct tet_testlist tet_testlist[] = {
75 { utcDaliSplineGetKnot01, POSITIVE_TC_IDX },
76 { utcDaliSplineGetKnot02, NEGATIVE_TC_IDX },
77 { utcDaliSplineGetKnot03, NEGATIVE_TC_IDX },
78 { utcDaliSplineGetOutTangent01, POSITIVE_TC_IDX },
79 { utcDaliSplineGetOutTangent02, NEGATIVE_TC_IDX },
80 { utcDaliSplineGetOutTangent03, NEGATIVE_TC_IDX },
81 { utcDaliSplineGetInTangent01, POSITIVE_TC_IDX },
82 { utcDaliSplineGetInTangent02, NEGATIVE_TC_IDX },
83 { utcDaliSplineGetInTangent03, NEGATIVE_TC_IDX },
84 { utcDaliSplineGenerateControlPoints01, POSITIVE_TC_IDX },
85 { utcDaliSplineGenerateControlPoints02, NEGATIVE_TC_IDX },
86 { utcDaliSplineGenerateControlPoints03, NEGATIVE_TC_IDX },
87 { UtcDaliSplineGetYFromMonotonicX, POSITIVE_TC_IDX },
88 { UtcDaliSplineGetY01, POSITIVE_TC_IDX },
89 { UtcDaliSplineGetY02, NEGATIVE_TC_IDX },
90 { UtcDaliSplineGetY02b, NEGATIVE_TC_IDX },
91 { UtcDaliSplineGetY03, NEGATIVE_TC_IDX },
92 { UtcDaliSplineGetY04, NEGATIVE_TC_IDX },
93 { UtcDaliSplineGetY04b,NEGATIVE_TC_IDX },
94 { UtcDaliSplineGetPoint01, POSITIVE_TC_IDX },
95 { UtcDaliSplineGetPoint02, POSITIVE_TC_IDX },
96 { UtcDaliSplineGetPoint03, NEGATIVE_TC_IDX },
97 { UtcDaliSplineGetPoint04, NEGATIVE_TC_IDX },
98 { UtcDaliSplineGetPoint05, NEGATIVE_TC_IDX },
99 { UtcDaliSplineGetPoint06, NEGATIVE_TC_IDX },
104 // Called only once before first test is run.
105 static void Startup()
109 // Called only once after last test is run
110 static void Cleanup()
114 // Knots fed into Allegro, which generates control points
115 static Spline* SetupBezierSpline1()
117 Spline *bezierSpline = new Spline();
119 bezierSpline->AddKnot(Vector3( 50.0, 50.0, 0.0));
120 bezierSpline->AddKnot(Vector3(120.0, 70.0, 0.0));
121 bezierSpline->AddKnot(Vector3(190.0, 250.0, 0.0));
122 bezierSpline->AddKnot(Vector3(260.0, 260.0, 0.0));
123 bezierSpline->AddKnot(Vector3(330.0, 220.0, 0.0));
124 bezierSpline->AddKnot(Vector3(400.0, 50.0, 0.0));
126 bezierSpline->SetInTangent (0, Vector3( 0.0, 0.0, 0.0));
127 bezierSpline->SetInTangent (1, Vector3(107.0, 58.0, 0.0));
128 bezierSpline->SetInTangent (2, Vector3(152.0, 220.0, 0.0));
129 bezierSpline->SetInTangent (3, Vector3(243.0, 263.0, 0.0));
130 bezierSpline->SetInTangent (4, Vector3(317.0, 235.0, 0.0));
131 bezierSpline->SetInTangent (5, Vector3(383.0, 93.0, 0.0));
133 bezierSpline->SetOutTangent(0, Vector3( 68.0, 55.0, 0.0));
134 bezierSpline->SetOutTangent(1, Vector3(156.0, 102.0, 0.0));
135 bezierSpline->SetOutTangent(2, Vector3(204.0, 261.0, 0.0));
136 bezierSpline->SetOutTangent(3, Vector3(280.0, 256.0, 0.0));
137 bezierSpline->SetOutTangent(4, Vector3(360.0, 185.0, 0.0));
138 bezierSpline->SetOutTangent(5, Vector3(410.0, 40.0, 0.0));
142 // Knots fed into Allegro, which generates control points
143 static Spline* SetupBezierSpline2()
145 Spline *spline = new Spline();
146 spline->AddKnot(Vector3( 30.0, 80.0, 0.0));
147 spline->AddKnot(Vector3( 70.0, 120.0, 0.0));
148 spline->AddKnot(Vector3(100.0, 100.0, 0.0));
149 spline->SetInTangent (0, Vector3( 0.0, 0.0, 0.0));
150 spline->SetInTangent (1, Vector3( 56.0, 119.0, 0.0));
151 spline->SetInTangent (2, Vector3( 93.0, 104.0, 0.0));
152 spline->SetOutTangent(0, Vector3( 39.0, 90.0, 0.0));
153 spline->SetOutTangent(1, Vector3( 78.0, 120.0, 0.0));
154 spline->SetOutTangent(2, Vector3(110.0, 90.0, 0.0));
184 // Positive test case for a method
185 static void UtcDaliSplineGetYFromMonotonicX()
187 TestApplication application;
189 Spline *bezierSpline = SetupBezierSpline1();
192 for(unsigned int i=0; i<sizeof(test)/sizeof(tPoint); i++)
194 DALI_TEST_EQUALS(1, 1, (const char *)TEST_LOCATION);
196 DALI_TEST_EQUALS((float)bezierSpline->GetYFromMonotonicX(test[i].x),
197 (float)test[i].y, 0.1f,
204 static void utcDaliSplineGetKnot01()
206 TestApplication application;
208 Spline *bezierSpline= new Spline();
209 bezierSpline->AddKnot(Vector3( 50.0, 50.0, 0.0));
210 bezierSpline->AddKnot(Vector3(120.0, 70.0, 0.0));
211 bezierSpline->AddKnot(Vector3(190.0, 250.0, 0.0));
212 bezierSpline->AddKnot(Vector3(260.0, 260.0, 0.0));
213 bezierSpline->AddKnot(Vector3(330.0, 220.0, 0.0));
214 bezierSpline->AddKnot(Vector3(400.0, 50.0, 0.0));
216 DALI_TEST_EQUALS(bezierSpline->GetKnot(0), Vector3( 50.0, 50.0, 0.0), TEST_LOCATION);
217 DALI_TEST_EQUALS(bezierSpline->GetKnot(1), Vector3(120.0, 70.0, 0.0), TEST_LOCATION);
218 DALI_TEST_EQUALS(bezierSpline->GetKnot(2), Vector3(190.0, 250.0, 0.0), TEST_LOCATION);
219 DALI_TEST_EQUALS(bezierSpline->GetKnot(3), Vector3(260.0, 260.0, 0.0), TEST_LOCATION);
220 DALI_TEST_EQUALS(bezierSpline->GetKnot(4), Vector3(330.0, 220.0, 0.0), TEST_LOCATION);
221 DALI_TEST_EQUALS(bezierSpline->GetKnot(5), Vector3(400.0, 50.0, 0.0), TEST_LOCATION);
224 static void utcDaliSplineGetKnot02()
226 TestApplication application;
228 Spline *bezierSpline= new Spline();
229 bezierSpline->AddKnot(Vector3( 50.0, 50.0, 0.0f));
233 bezierSpline->GetKnot(1);
234 tet_result(TET_FAIL);
236 catch (Dali::DaliException& e)
238 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
239 DALI_TEST_ASSERT(e, "knotIndex < mKnots.size()", TEST_LOCATION);
243 static void utcDaliSplineGetKnot03()
245 TestApplication application;
247 Spline *bezierSpline= new Spline();
251 bezierSpline->GetKnot(0);
252 tet_result(TET_FAIL);
254 catch (Dali::DaliException& e)
256 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
257 DALI_TEST_ASSERT(e, "knotIndex < mKnots.size()", TEST_LOCATION);
261 static void utcDaliSplineGetInTangent01()
263 TestApplication application;
265 Spline *bezierSpline= new Spline();
266 bezierSpline->AddKnot(Vector3( 50.0, 50.0, 0.0));
267 bezierSpline->AddKnot(Vector3(120.0, 70.0, 0.0));
268 bezierSpline->SetInTangent(0, Vector3(0.0f, 0.0f, 0.0)); // Intangent for initial value is unused
269 bezierSpline->SetInTangent(1, Vector3(108.0f, 57.0f, 0.0));
271 DALI_TEST_EQUALS(bezierSpline->GetInTangent(0), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
272 DALI_TEST_EQUALS(bezierSpline->GetInTangent(1), Vector3(108.0f, 57.0f, 0.0f), TEST_LOCATION);
277 static void utcDaliSplineGetInTangent02()
279 TestApplication application;
281 Spline *bezierSpline= new Spline();
282 bezierSpline->AddKnot(Vector3( 50.0, 50.0, 0.0));
283 bezierSpline->AddKnot(Vector3(120.0, 70.0, 0.0));
284 bezierSpline->SetInTangent(0, Vector3(0.0f, 0.0f, 0.0)); // Intangent for initial value is unused
285 bezierSpline->SetInTangent(1, Vector3(108.0f, 57.0f, 0.0));
289 bezierSpline->GetInTangent(5);
290 tet_result(TET_FAIL);
292 catch (Dali::DaliException& e)
294 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
295 DALI_TEST_ASSERT(e, "knotIndex < mInTangents.size()", TEST_LOCATION);
300 static void utcDaliSplineGetInTangent03()
302 TestApplication application;
304 Spline *bezierSpline= new Spline();
307 bezierSpline->GetInTangent(0);
308 tet_result(TET_FAIL);
310 catch (Dali::DaliException& e)
312 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
313 DALI_TEST_ASSERT(e, "knotIndex < mInTangents.size()", TEST_LOCATION);
318 static void utcDaliSplineGetOutTangent01()
320 TestApplication application;
322 Spline *bezierSpline= new Spline();
323 bezierSpline->AddKnot(Vector3( 50.0, 50.0, 0.0));
324 bezierSpline->AddKnot(Vector3(120.0, 70.0, 0.0));
325 bezierSpline->SetOutTangent(0, Vector3(0.0f, 0.0f, 0.0)); // Intangent for initial value is unused
326 bezierSpline->SetOutTangent(1, Vector3(108.0f, 57.0f, 0.0));
328 DALI_TEST_EQUALS(bezierSpline->GetOutTangent(0), Vector3(0.0f, 0.0f, 0.0f), TEST_LOCATION);
329 DALI_TEST_EQUALS(bezierSpline->GetOutTangent(1), Vector3(108.0f, 57.0f, 0.0f), TEST_LOCATION);
334 static void utcDaliSplineGetOutTangent02()
336 TestApplication application;
338 Spline *bezierSpline= new Spline();
339 bezierSpline->AddKnot(Vector3( 50.0, 50.0, 0.0));
340 bezierSpline->AddKnot(Vector3(120.0, 70.0, 0.0));
341 bezierSpline->SetOutTangent(0, Vector3(0.0f, 0.0f, 0.0)); // Intangent for initial value is unused
342 bezierSpline->SetOutTangent(1, Vector3(108.0f, 57.0f, 0.0));
346 bezierSpline->GetOutTangent(5);
347 tet_result(TET_FAIL);
349 catch (Dali::DaliException& e)
351 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
352 DALI_TEST_ASSERT(e, "knotIndex < mOutTangents.size()", TEST_LOCATION);
357 static void utcDaliSplineGetOutTangent03()
359 TestApplication application;
361 Spline *bezierSpline= new Spline();
364 bezierSpline->GetOutTangent(0);
365 tet_result(TET_FAIL);
367 catch (Dali::DaliException& e)
369 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
370 DALI_TEST_ASSERT(e, "knotIndex < mOutTangents.size()", TEST_LOCATION);
375 static void utcDaliSplineGenerateControlPoints01()
377 TestApplication application;
379 Spline *bezierSpline = new Spline();
381 bezierSpline->AddKnot(Vector3( 50.0, 50.0, 0.0));
382 bezierSpline->AddKnot(Vector3(120.0, 70.0, 0.0));
383 bezierSpline->AddKnot(Vector3(190.0, 250.0, 0.0));
384 bezierSpline->AddKnot(Vector3(260.0, 260.0, 0.0));
385 bezierSpline->AddKnot(Vector3(330.0, 220.0, 0.0));
386 bezierSpline->AddKnot(Vector3(400.0, 50.0, 0.0));
388 bezierSpline->GenerateControlPoints(0.25);
390 // first in tangent is never used, ignore it.
391 DALI_TEST_EQUALS(bezierSpline->GetInTangent(1), Vector3(107.0, 58.0, 0.0), 1.0, TEST_LOCATION);
392 DALI_TEST_EQUALS(bezierSpline->GetInTangent(2), Vector3(152.0, 220.0, 0.0), 1.0, TEST_LOCATION);
393 DALI_TEST_EQUALS(bezierSpline->GetInTangent(3), Vector3(243.0, 263.0, 0.0), 1.0, TEST_LOCATION);
394 DALI_TEST_EQUALS(bezierSpline->GetInTangent(4), Vector3(317.0, 235.0, 0.0), 1.0, TEST_LOCATION);
395 DALI_TEST_EQUALS(bezierSpline->GetInTangent(5), Vector3(383.0, 93.0, 0.0), 1.0, TEST_LOCATION);
397 DALI_TEST_EQUALS(bezierSpline->GetOutTangent(0), Vector3( 68.0, 55.0, 0.0), 1.0, TEST_LOCATION);
398 DALI_TEST_EQUALS(bezierSpline->GetOutTangent(1), Vector3(156.0, 102.0, 0.0), 1.0, TEST_LOCATION);
399 DALI_TEST_EQUALS(bezierSpline->GetOutTangent(2), Vector3(204.0, 261.0, 0.0), 1.0, TEST_LOCATION);
400 DALI_TEST_EQUALS(bezierSpline->GetOutTangent(3), Vector3(280.0, 256.0, 0.0), 1.0, TEST_LOCATION);
401 DALI_TEST_EQUALS(bezierSpline->GetOutTangent(4), Vector3(360.0, 185.0, 0.0), 1.0, TEST_LOCATION);
402 // last out tangent is never used, ignore it.
405 static void utcDaliSplineGenerateControlPoints02()
407 TestApplication application;
409 Spline *bezierSpline = new Spline();
412 bezierSpline->GenerateControlPoints(0.25);
413 tet_result(TET_FAIL);
415 catch (Dali::DaliException& e)
417 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
418 DALI_TEST_ASSERT(e, "numKnots > 1", TEST_LOCATION);
423 static void utcDaliSplineGenerateControlPoints03()
425 TestApplication application;
427 Spline *bezierSpline = new Spline();
428 bezierSpline->AddKnot(Vector3(400.0, 50.0, 0.0f));
431 bezierSpline->GenerateControlPoints(0.25);
432 tet_result(TET_FAIL);
434 catch (Dali::DaliException& e)
436 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
437 DALI_TEST_ASSERT(e, "numKnots > 1", TEST_LOCATION);
442 static void UtcDaliSplineGetY01()
444 TestApplication application;
445 Spline *spline = SetupBezierSpline2();
447 DALI_TEST_EQUALS(spline->GetY(0, 0.0f), 80.0f, TEST_LOCATION); // First control point
448 DALI_TEST_EQUALS(spline->GetY(0, 0.5f), 102.0f, 2.0f, TEST_LOCATION);
449 DALI_TEST_EQUALS(spline->GetY(0, 1.0f), 120.0f, TEST_LOCATION); // Second control point
450 DALI_TEST_EQUALS(spline->GetY(1, 0.0f), 120.0f, TEST_LOCATION); // Second control point
451 DALI_TEST_EQUALS(spline->GetY(1, 0.5f), 112.0f, 2.0f, TEST_LOCATION);
452 DALI_TEST_EQUALS(spline->GetY(1, 1.0f), 100.0f, TEST_LOCATION); // Third control point
456 // Test segments outside range (should assert and fail tetcase!)
457 static void UtcDaliSplineGetY02()
459 TestApplication application;
463 Spline *spline = SetupBezierSpline2();
464 spline->GetY(3, 0.0f); // Segment outside range - expect assertion
466 // If we get here, assertion hasn't triggered.
467 tet_result(TET_FAIL);
470 catch (Dali::DaliException& e)
472 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
473 DALI_TEST_ASSERT(e, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION);
477 // Test segments outside range (should assert and fail tetcase!)
478 static void UtcDaliSplineGetY02b()
480 TestApplication application;
483 Spline *spline = SetupBezierSpline2();
484 spline->GetY(-1, 0.0f); // Segment outside range - expect assertion
486 // If we get here, assertion hasn't triggered.
487 tet_result(TET_FAIL);
490 catch (Dali::DaliException& e)
492 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
493 DALI_TEST_ASSERT(e, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION);
498 // Test parameter ouside 0-1 - should return 0.
499 static void UtcDaliSplineGetY03()
501 TestApplication application;
502 Spline *spline = SetupBezierSpline2();
503 DALI_TEST_EQUALS(spline->GetY(1, -1.0f), 0.0f, TEST_LOCATION);
504 DALI_TEST_EQUALS(spline->GetY(1, 2.0f), 0.0f, TEST_LOCATION);
508 // Test on empty spline - should assert
509 static void UtcDaliSplineGetY04()
511 TestApplication application;
514 Spline *spline = new Spline();
515 spline->GetY(0, 0.0f); // Should assert
516 tet_result(TET_FAIL);
519 catch (Dali::DaliException& e)
521 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
522 DALI_TEST_ASSERT(e, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION);
527 // Test on empty spline - should assert
528 static void UtcDaliSplineGetY04b()
530 TestApplication application;
533 Spline *spline = new Spline();
534 spline->GetY(0, 1.0f);
535 tet_result(TET_FAIL); // assertion didn't trigger
538 catch (Dali::DaliException& e)
540 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
541 DALI_TEST_ASSERT(e, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION);
547 static void UtcDaliSplineGetPoint01()
549 TestApplication application;
550 Spline *spline = SetupBezierSpline2();
552 // Test control points
553 Vector3 pt = spline->GetPoint(0, 0.0f);
554 DALI_TEST_EQUALS(pt.x, 30.0f, TEST_LOCATION);
555 DALI_TEST_EQUALS(pt.y, 80.0f, TEST_LOCATION);
557 // Test control points
558 pt = spline->GetPoint(0, 1.0f);
559 DALI_TEST_EQUALS(pt.x, 70.0f, TEST_LOCATION);
560 DALI_TEST_EQUALS(pt.y, 120.0f, TEST_LOCATION);
562 // Halfway point computed using Allegro engine
563 pt = spline->GetPoint(0, 0.5f);
564 DALI_TEST_EQUALS(pt.x, 47.0f, 2.0f, TEST_LOCATION);
565 DALI_TEST_EQUALS(pt.y, 102.0f, 2.0f, TEST_LOCATION);
567 // Test control point
568 pt = spline->GetPoint(1, 0.0f);
569 DALI_TEST_EQUALS(pt.x, 70.0f, TEST_LOCATION);
570 DALI_TEST_EQUALS(pt.y, 120.0f, TEST_LOCATION);
572 // Halfway point computed using Allegro engine
573 pt = spline->GetPoint(1, 0.5f);
574 DALI_TEST_EQUALS(pt.x, 85.0f, 2.0f, TEST_LOCATION);
575 DALI_TEST_EQUALS(pt.y, 112.0f, 2.0f, TEST_LOCATION);
577 // Test control points
578 pt = spline->GetPoint(1, 1.0f);
579 DALI_TEST_EQUALS(pt.x, 100.0f, TEST_LOCATION);
580 DALI_TEST_EQUALS(pt.y, 100.0f, TEST_LOCATION);
585 static void UtcDaliSplineGetPoint02()
587 TestApplication application;
588 Spline *spline = SetupBezierSpline2();
590 // Test control points
591 Vector3 pt = spline->GetPoint(0.0f);
592 DALI_TEST_EQUALS(pt.x, 30.0f, TEST_LOCATION);
593 DALI_TEST_EQUALS(pt.y, 80.0f, TEST_LOCATION);
595 // Halfway point computed using Allegro engine
596 pt = spline->GetPoint(0.25f);
597 DALI_TEST_EQUALS(pt.x, 47.0f, 2.0f, TEST_LOCATION);
598 DALI_TEST_EQUALS(pt.y, 102.0f, 2.0f, TEST_LOCATION);
600 // Test control points
601 pt = spline->GetPoint(0.5f);
602 DALI_TEST_EQUALS(pt.x, 70.0f, TEST_LOCATION);
603 DALI_TEST_EQUALS(pt.y, 120.0f, TEST_LOCATION);
605 // Halfway point computed using Allegro engine
606 pt = spline->GetPoint(0.75f);
607 DALI_TEST_EQUALS(pt.x, 85.0f, 2.0f, TEST_LOCATION);
608 DALI_TEST_EQUALS(pt.y, 112.0f, 2.0f, TEST_LOCATION);
610 // Test control points
611 pt = spline->GetPoint(1.0f);
612 DALI_TEST_EQUALS(pt.x, 100.0f, TEST_LOCATION);
613 DALI_TEST_EQUALS(pt.y, 100.0f, TEST_LOCATION);
618 // Test on segment index out of bounds - should assert and fail tet case
619 static void UtcDaliSplineGetPoint03()
621 TestApplication application;
624 Spline *spline = SetupBezierSpline2();
626 spline->GetPoint(-1, 0.5f); // should assert
627 tet_result(TET_FAIL);
630 catch (Dali::DaliException& e)
632 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
633 DALI_TEST_ASSERT(e, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION);
637 // Test on segment index out of bounds - should assert and fail tet case
638 static void UtcDaliSplineGetPoint04()
640 TestApplication application;
643 Spline *spline = SetupBezierSpline2();
645 spline->GetPoint(123, 0.5f); // should assert
646 tet_result(TET_FAIL);
649 catch (Dali::DaliException& e)
651 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
652 DALI_TEST_ASSERT(e, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION);
657 // Test on parameter out of bounds - should return 0,0
658 static void UtcDaliSplineGetPoint05()
660 TestApplication application;
661 Spline *spline = SetupBezierSpline2();
663 Vector3 pt = spline->GetPoint(0, -32.0f);
664 DALI_TEST_EQUALS(pt.x, 0.0f, TEST_LOCATION);
665 DALI_TEST_EQUALS(pt.y, 0.0f, TEST_LOCATION);
667 pt = spline->GetPoint(0, 23444.0f);
668 DALI_TEST_EQUALS(pt.x, 0.0f, TEST_LOCATION);
669 DALI_TEST_EQUALS(pt.y, 0.0f, TEST_LOCATION);
672 // Test on empty spline - should assert and fail tet case
673 static void UtcDaliSplineGetPoint06()
675 TestApplication application;
678 Spline *spline = new Spline();
679 spline->GetPoint(0, 23444.0f);
680 tet_result(TET_FAIL);
683 catch (Dali::DaliException& e)
685 tet_printf("Assertion %s failed at %s\n", e.mCondition.c_str(), e.mLocation.c_str());
686 DALI_TEST_ASSERT(e, "segmentIndex+1 < mKnots.size() && segmentIndex < mKnots.size()", TEST_LOCATION);