2 * Copyright (C) 2013 Dan Dennedy <dan@dennedy.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with consumer library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <mlt++/Mlt.h>
27 #include <framework/mlt_property.h>
28 #include <framework/mlt_animation.h>
32 class TestProperties: public QObject
39 #if defined(__linux__) || defined(__DARWIN__)
40 locale = newlocale( LC_NUMERIC_MASK, "POSIX", NULL );
45 void InstantiationIsAReference()
48 QCOMPARE(p.ref_count(), 1);
51 void CopyAddsReference()
55 QCOMPARE(p.ref_count(), 2);
58 void DestructionRemovesReference()
61 Properties* q = new Properties(p);
62 QCOMPARE(p.ref_count(), 2);
64 QCOMPARE(p.ref_count(), 1);
67 void SetAndGetString()
70 p.set("key", "value");
71 QVERIFY(p.get("key"));
72 QVERIFY(QString(p.get("key")) != QString(""));
73 QCOMPARE(p.get("key"), "value");
81 QCOMPARE(p.get_int("key"), i);
84 void SetAndGetDouble()
89 QCOMPARE(p.get_double("key"), d);
95 int64_t i = 1LL << 32;
97 QCOMPARE(p.get_int64("key"), i);
103 const char *value = "value";
104 char* const s = strdup(value);
105 p.set("key", s, strlen(s), free);
107 QCOMPARE((char*) p.get_data("key", size), value);
108 QCOMPARE(size, int(strlen(value)));
114 const char *s = "-1";
117 QCOMPARE(p.get("key"), s);
119 QCOMPARE(p.get_int("key"), i);
122 void Int64FromString()
125 const char *s = "-1";
128 QCOMPARE(p.get("key"), s);
130 QCOMPARE(p.get_int64("key"), i);
133 void DoubleFromString()
136 const char *s = "-1.234567";
137 double d = -1.234567;
139 QCOMPARE(p.get("key"), s);
141 QCOMPARE(p.get_double("key"), d);
144 void SetNullRemovesProperty()
147 const char *s = NULL;
148 p.set("key", "value");
150 QCOMPARE(p.get("key"), s);
153 void SetAndGetHexColor()
156 const char *hexColorString = "0xaabbccdd";
157 int hexColorInt = 0xaabbccdd;
158 p.set("key", hexColorString);
159 QCOMPARE(p.get_int("key"), hexColorInt);
162 void SetAndGetCssColor()
165 const char *cssColorString = "#aabbcc";
166 int cssColorInt = 0xaabbccff;
167 p.set("key", cssColorString);
168 QCOMPARE(p.get_int("key"), cssColorInt);
170 const char *cssColorAlphaString = "#00aabbcc";
171 int cssColorAlphaInt = 0xaabbcc00;
172 p.set("key", cssColorAlphaString);
173 QCOMPARE(p.get_int("key"), cssColorAlphaInt);
176 void SetAndGetTimeCode()
180 p.set("_profile", profile.get_profile(), 0);
181 const char *timeString = "11:22:33:04";
182 p.set("key", timeString);
183 QCOMPARE(p.get_int("key"), 1023829);
184 p.set("key", 1023829);
185 QCOMPARE(p.get_time("key", mlt_time_smpte), timeString);
188 void SetAndGetTimeClock()
192 p.set("_profile", profile.get_profile(), 0);
193 const char *timeString = "11:22:33.400";
194 p.set("key", timeString);
195 QCOMPARE(p.get_int("key"), 1023835);
196 p.set("key", 1023835);
197 QCOMPARE(p.get_time("key", mlt_time_clock), timeString);
200 void SetSimpleMathExpression()
203 p.set("key", "@16.0/9.0 *2 +3 -1");
204 QCOMPARE(p.get_int("key"), 5);
205 QCOMPARE(p.get_double("key"), 16.0/9.0 *2 +3 -1);
208 void PassOneProperty()
211 const char *s = "value";
213 QCOMPARE(p[1].get("key"), (void*) 0);
214 p[1].pass_property(p[0], "key");
215 QCOMPARE(p[1].get("key"), s);
218 void PassMultipleByPrefix()
221 const char *s = "value";
222 p[0].set("key.one", s);
223 p[0].set("key.two", s);
224 QCOMPARE(p[1].get("key.one"), (void*) 0);
225 QCOMPARE(p[1].get("key.two"), (void*) 0);
226 p[1].pass_values(p[0], "key.");
227 QCOMPARE(p[1].get("one"), s);
228 QCOMPARE(p[1].get("two"), s);
231 void PassMultipleByList()
234 const char *s = "value";
235 p[0].set("key.one", s);
236 p[0].set("key.two", s);
237 QCOMPARE(p[1].get("key.one"), (void*) 0);
238 QCOMPARE(p[1].get("key.two"), (void*) 0);
239 p[1].pass_list(p[0], "key.one key.two");
240 QCOMPARE(p[1].get("key.one"), s);
241 QCOMPARE(p[1].get("key.two"), s);
244 void MirrorProperties()
248 p[0].set("key", "value");
249 QCOMPARE(p[1].get("key"), "value");
252 void InheritProperties()
255 p[0].set("key", "value");
256 QVERIFY(p[1].get("key") == 0);
258 QCOMPARE(p[1].get("key"), "value");
264 QCOMPARE(p.get("key"), (void*) 0);
265 p.parse("key=value");
266 QCOMPARE(p.get("key"), "value");
267 p.parse("key=\"new value\"");
268 QCOMPARE(p.get("key"), "new value");
271 void RenameProperty()
274 p.set("key", "value");
275 QVERIFY(p.get("new key") == 0);
276 p.rename("key", "new key");
277 QCOMPARE(p.get("new key"), "value");
280 void SequenceDetected()
286 QVERIFY(p.is_sequence());
288 QVERIFY(!p.is_sequence());
291 void SerializesToYamlTiny()
294 p[0].set("key1", "value1");
295 p[0].set("key2", "value2");
296 p[1].set("1", "value3");
297 p[1].set("2", "value4");
298 p[0].set("seq", p[1].get_properties(), 0);
299 QCOMPARE(p[0].serialise_yaml(),
309 void RadixRespondsToLocale()
312 p.set_lcnumeric("en_US");
313 p.set("key", "0.125");
314 QCOMPARE(p.get_double("key"), double(1) / double(8));
315 p.set_lcnumeric("de_DE");
316 p.set("key", "0,125");
317 QCOMPARE(p.get_double("key"), double(1) / double(8));
320 void DoubleAnimation()
323 mlt_animation a = mlt_animation_new();
324 struct mlt_animation_item_s item;
326 mlt_animation_parse(a, "50=1; 60=60; 100=0", 100, fps, locale);
327 mlt_animation_remove(a, 60);
328 char *a_serialized = mlt_animation_serialize(a);
329 QCOMPARE(a_serialized, "50=1;100=0");
330 if (a_serialized) free(a_serialized);
331 item.property = mlt_property_init();
333 mlt_animation_get_item(a, &item, 10);
334 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 1.0);
335 QCOMPARE(item.is_key, 0);
337 mlt_animation_get_item(a, &item, 50);
338 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 1.0);
339 QCOMPARE(item.is_key, 1);
341 mlt_animation_get_item(a, &item, 75);
342 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 0.5);
343 QCOMPARE(item.is_key, 0);
345 mlt_animation_get_item(a, &item, 100);
346 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 0.0);
347 QCOMPARE(item.is_key, 1);
349 mlt_animation_get_item(a, &item, 110);
350 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 0.0);
351 QCOMPARE(item.is_key, 0);
353 mlt_property_close(item.property);
354 mlt_animation_close(a);
360 mlt_animation a = mlt_animation_new();
361 struct mlt_animation_item_s item;
363 mlt_animation_parse(a, "50=100; 60=60; 100=0", 100, fps, locale);
364 mlt_animation_remove(a, 60);
365 char *a_serialized = mlt_animation_serialize(a);
366 QCOMPARE(a_serialized, "50=100;100=0");
367 if (a_serialized) free(a_serialized);
368 item.property = mlt_property_init();
370 mlt_animation_get_item(a, &item, 10);
371 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 100);
372 QCOMPARE(item.is_key, 0);
374 mlt_animation_get_item(a, &item, 50);
375 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 100);
376 QCOMPARE(item.is_key, 1);
378 mlt_animation_get_item(a, &item, 75);
379 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 50);
380 QCOMPARE(item.is_key, 0);
382 mlt_animation_get_item(a, &item, 100);
383 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 0);
384 QCOMPARE(item.is_key, 1);
386 mlt_animation_get_item(a, &item, 110);
387 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 0);
388 QCOMPARE(item.is_key, 0);
390 mlt_property_close(item.property);
391 mlt_animation_close(a);
394 void AnimationWithTimeValueKeyframes()
397 mlt_animation a = mlt_animation_new();
398 struct mlt_animation_item_s item;
400 mlt_animation_parse(a, ":2.0=1; :4.0=0", 100, fps, locale);
401 char *a_serialized = mlt_animation_serialize(a);
402 // Time serializes to frame units :-\.
403 QCOMPARE(a_serialized, "50=1;100=0");
404 if (a_serialized) free(a_serialized);
405 item.property = mlt_property_init();
407 mlt_animation_get_item(a, &item, 10);
408 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 1.0);
409 QCOMPARE(item.is_key, 0);
411 mlt_animation_get_item(a, &item, 50);
412 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 1.0);
413 QCOMPARE(item.is_key, 1);
415 mlt_animation_get_item(a, &item, 75);
416 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 0.5);
417 QCOMPARE(item.is_key, 0);
419 mlt_animation_get_item(a, &item, 100);
420 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 0.0);
421 QCOMPARE(item.is_key, 1);
423 mlt_animation_get_item(a, &item, 110);
424 QCOMPARE(mlt_property_get_double(item.property, fps, locale), 0.0);
425 QCOMPARE(item.is_key, 0);
427 mlt_property_close(item.property);
428 mlt_animation_close(a);
431 void DiscreteIntAnimation()
434 mlt_animation a = mlt_animation_new();
435 struct mlt_animation_item_s item;
437 mlt_animation_parse(a, "50|=100; 60|=60; 100|=0", 100, fps, locale);
438 char *a_serialized = mlt_animation_serialize(a);
439 QCOMPARE(a_serialized, "50|=100;60|=60;100|=0");
440 if (a_serialized) free(a_serialized);
441 item.property = mlt_property_init();
443 mlt_animation_get_item(a, &item, 10);
444 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 100);
445 QCOMPARE(item.is_key, 0);
447 mlt_animation_get_item(a, &item, 50);
448 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 100);
449 QCOMPARE(item.is_key, 1);
451 mlt_animation_get_item(a, &item, 55);
452 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 100);
453 QCOMPARE(item.is_key, 0);
455 mlt_animation_get_item(a, &item, 60);
456 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 60);
457 QCOMPARE(item.is_key, 1);
459 mlt_animation_get_item(a, &item, 75);
460 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 60);
461 QCOMPARE(item.is_key, 0);
463 mlt_animation_get_item(a, &item, 100);
464 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 0);
465 QCOMPARE(item.is_key, 1);
467 mlt_animation_get_item(a, &item, 110);
468 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 0);
469 QCOMPARE(item.is_key, 0);
471 mlt_property_close(item.property);
472 mlt_animation_close(a);
475 void StringAnimation()
478 mlt_animation a = mlt_animation_new();
479 struct mlt_animation_item_s item;
481 mlt_animation_parse(a, "50=hello world; 60=\"good night\"; 100=bar", 100, fps, locale);
482 char *a_serialized = mlt_animation_serialize(a);
483 QCOMPARE(a_serialized, "50=hello world;60=\"good night\";100=bar");
484 if (a_serialized) free(a_serialized);
485 item.property = mlt_property_init();
487 mlt_animation_get_item(a, &item, 10);
488 QCOMPARE(mlt_property_get_string(item.property), "hello world");
489 QCOMPARE(item.is_key, 0);
491 mlt_animation_get_item(a, &item, 50);
492 QCOMPARE(mlt_property_get_string(item.property), "hello world");
493 QCOMPARE(item.is_key, 1);
495 mlt_animation_get_item(a, &item, 75);
496 QCOMPARE(mlt_property_get_string(item.property), "\"good night\"");
497 QCOMPARE(item.is_key, 0);
499 mlt_animation_get_item(a, &item, 100);
500 QCOMPARE(mlt_property_get_string(item.property), "bar");
501 QCOMPARE(item.is_key, 1);
503 mlt_animation_get_item(a, &item, 110);
504 QCOMPARE(mlt_property_get_string(item.property), "bar");
505 QCOMPARE(item.is_key, 0);
507 mlt_property_close(item.property);
508 mlt_animation_close(a);
511 void test_property_get_double_pos()
514 mlt_property p = mlt_property_init();
515 mlt_property_set_string(p, "10=100; 20=200");
516 QCOMPARE(mlt_property_get_double(p, fps, locale), 10.0);
517 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 0, 100), 100.0);
518 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 15, 100), 150.0);
519 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 20, 100), 200.0);
521 mlt_property_set_string(p, "1.5");
522 QCOMPARE(mlt_property_get_double(p, fps, locale), 1.5);
523 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 10, 100), 1.5);
525 mlt_property_close(p);
528 void test_property_get_int_pos()
531 mlt_property p = mlt_property_init();
532 mlt_property_set_string(p, "10=100; 20=200");
533 QCOMPARE(mlt_property_get_int(p, fps, locale), 10);
534 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 0, 100), 100);
535 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 15, 100), 150);
536 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 20, 100), 200);
538 mlt_property_set_string(p, "1.5");
539 QCOMPARE(mlt_property_get_int(p, fps, locale), 1);
540 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 10, 100), 1);
542 mlt_property_close(p);
545 void SmoothIntAnimation()
548 mlt_animation a = mlt_animation_new();
549 struct mlt_animation_item_s item;
551 mlt_animation_parse(a, "0=80;10~=80; 20~=30; 30~=40; 40~=28; 50=90; 60=0; 70=60; 80=20", 100, fps, locale);
552 item.property = mlt_property_init();
553 char *a_serialized = mlt_animation_serialize(a);
554 QCOMPARE(a_serialized, "0=80;10~=80;20~=30;30~=40;40~=28;50=90;60=0;70=60;80=20");
555 if (a_serialized) free(a_serialized);
557 mlt_animation_get_item(a, &item, 10);
558 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 80);
559 QCOMPARE(item.is_key, 1);
561 mlt_animation_get_item(a, &item, 50);
562 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 90);
563 QCOMPARE(item.is_key, 1);
565 mlt_animation_get_item(a, &item, 55);
566 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 45);
567 QCOMPARE(item.is_key, 0);
569 mlt_animation_get_item(a, &item, 60);
570 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 0);
571 QCOMPARE(item.is_key, 1);
573 mlt_animation_get_item(a, &item, 75);
574 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 40);
575 QCOMPARE(item.is_key, 0);
577 mlt_animation_get_item(a, &item, 100);
578 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 20);
579 QCOMPARE(item.is_key, 0);
581 mlt_animation_get_item(a, &item, 110);
582 QCOMPARE(mlt_property_get_int(item.property, fps, locale), 20);
583 QCOMPARE(item.is_key, 0);
585 mlt_property_close(item.property);
586 mlt_animation_close(a);
589 void test_property_set_double_pos()
592 mlt_property p = mlt_property_init();
593 mlt_property_set_string(p, "10=100; 20=200");
594 mlt_property_set_double_pos(p, 1.5, fps, locale, mlt_keyframe_linear, 30, 100);
595 QCOMPARE(mlt_property_get_double(p, fps, locale), 10.0);
596 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 0, 100), 100.0);
597 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 15, 100), 150.0);
598 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 20, 100), 200.0);
599 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 25, 100), 100.75);
600 QCOMPARE(mlt_property_get_double_pos(p, fps, locale, 30, 100), 1.5);
601 mlt_property_close(p);
604 void test_property_set_int_pos()
607 mlt_property p = mlt_property_init();
608 mlt_property_set_string(p, "10=100; 20=200");
609 mlt_property_set_int_pos(p, 300, fps, locale, mlt_keyframe_linear, 30, 100);
610 QCOMPARE(mlt_property_get_int(p, fps, locale), 10);
611 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 0, 100), 100);
612 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 15, 100), 150);
613 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 20, 100), 200);
614 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 25, 100), 250);
615 QCOMPARE(mlt_property_get_int_pos(p, fps, locale, 30, 100), 300);
616 mlt_property_close(p);
619 void PercentAsRatio()
622 p.set("foo", "12.3%");
623 QCOMPARE(p.get_double("foo"), 0.123);
624 p.set("foo", "456 %");
625 QCOMPARE(p.get_double("foo"), 456.0);
628 void PropertiesAnimInt()
632 p.set_lcnumeric("POSIX");
634 // Construct animation from scratch
635 p.set("foo", 0, 0, len);
636 p.set("foo", 100, 50, len, mlt_keyframe_smooth);
637 QCOMPARE(p.get_int("foo", 0, len), 0);
638 QCOMPARE(p.get_int("foo", 25, len), 50);
639 QCOMPARE(p.get_int("foo", 50, len), 100);
640 QCOMPARE(p.get("foo"), "0=0;50~=100");
642 // Animation from string value
643 p.set("foo", "10=100;20=200");
644 QCOMPARE(p.get_int("foo", 0, len), 100);
645 QCOMPARE(p.get_int("foo", 15, len), 150);
646 QCOMPARE(p.get_int("foo", 20, len), 200);
648 // Animation from string using time clock values
649 // Need to set a profile so fps can be used to convert time to frames.
650 Profile profile("dv_pal");
651 p.set("_profile", profile.get_profile(), 0);
652 p.set("foo", ":0.0=100; :2.0=200");
653 QCOMPARE(p.get_int("foo", 0, len), 100);
654 QCOMPARE(p.get_int("foo", 25, len), 150);
655 QCOMPARE(p.get_int("foo", 50, len), 200);
660 mlt_property p = mlt_property_init();
661 mlt_rect r = { 1, 2, 3, 4, 5 };
663 mlt_property_set_rect( p, r );
664 QCOMPARE(mlt_property_get_string(p), "1 2 3 4 5");
666 mlt_property_set_rect( p, r );
667 QCOMPARE(mlt_property_get_string(p), "1 2 3 4");
670 mlt_property_set_rect( p, r );
671 QCOMPARE(mlt_property_get_string(p), "1 2");
673 mlt_property_set_string(p, "1.1/2.2:3.3x4.4:5.5");
674 r = mlt_property_get_rect(p, locale);
681 mlt_property_set_string(p, "1.1 2.2");
682 r = mlt_property_get_rect(p, locale);
685 QCOMPARE(r.w, DBL_MIN);
687 mlt_property_set_int64(p, UINT_MAX);
688 r = mlt_property_get_rect(p, locale);
689 QCOMPARE(r.x, double(UINT_MAX));
691 mlt_property_close(p);
704 mlt_rect q = p.get_rect("key");
710 p.set("key", 10, 20, 30, 40);
711 q = p.get_rect("key");
718 void RectFromString()
721 p.set_lcnumeric("POSIX");
722 const char *s = "1.1 2.2 3.3 4.4 5.5";
723 mlt_rect r = { 1.1, 2.2, 3.3, 4.4, 5.5 };
725 QCOMPARE(p.get("key"), s);
727 r = p.get_rect("key");
738 mlt_rect r1 = { 0, 0, 200, 200, 0 };
739 mlt_rect r2 = { 100, 100, 400, 400, 1.0 };
741 p.set_lcnumeric("POSIX");
743 // Construct animation from scratch
744 p.set("key", r1, 0, len);
745 p.set("key", r2, 50, len);
746 QCOMPARE(p.get_rect("key", 0, len).x, 0.0);
747 QCOMPARE(p.get_rect("key", 25, len).x, 50.0);
748 QCOMPARE(p.get_rect("key", 25, len).y, 50.0);
749 QCOMPARE(p.get_rect("key", 25, len).w, 300.0);
750 QCOMPARE(p.get_rect("key", 25, len).h, 300.0);
751 QCOMPARE(p.get_rect("key", 25, len).o, 0.5);
752 QCOMPARE(p.get_rect("key", 50, len).x, 100.0);
753 QCOMPARE(p.get("key"), "0=0 0 200 200 0;50=100 100 400 400 1");
755 // Animation from string value
756 QCOMPARE(p.get_rect("key", 0, len).x, 0.0);
757 QCOMPARE(p.get_rect("key", 0, len).y, 0.0);
758 QCOMPARE(p.get_rect("key", 0, len).w, 200.0);
759 QCOMPARE(p.get_rect("key", 0, len).h, 200.0);
760 QCOMPARE(p.get_rect("key", 0, len).o, 0.0);
761 QCOMPARE(p.get_rect("key", 50, len).x, 100.0);
762 QCOMPARE(p.get_rect("key", 50, len).y, 100.0);
763 QCOMPARE(p.get_rect("key", 50, len).w, 400.0);
764 QCOMPARE(p.get_rect("key", 50, len).h, 400.0);
765 QCOMPARE(p.get_rect("key", 50, len).o, 1.0);
766 QCOMPARE(p.get_rect("key", 15, len).x, 30.0);
767 QCOMPARE(p.get_rect("key", 15, len).y, 30.0);
768 QCOMPARE(p.get_rect("key", 15, len).w, 260.0);
769 QCOMPARE(p.get_rect("key", 15, len).h, 260.0);
770 QCOMPARE(p.get_rect("key", 15, len).o, 0.3);
773 p.set("key", "0~=0/0:200x200:0; 50=100/100:400x400:1");
774 QCOMPARE(p.get_rect("key", 0, len).x, 0.0);
775 QCOMPARE(p.get_rect("key", 0, len).y, 0.0);
776 QCOMPARE(p.get_rect("key", 0, len).w, 200.0);
777 QCOMPARE(p.get_rect("key", 0, len).h, 200.0);
778 QCOMPARE(p.get_rect("key", 0, len).o, 0.0);
779 QCOMPARE(p.get_rect("key", 50, len).x, 100.0);
780 QCOMPARE(p.get_rect("key", 50, len).y, 100.0);
781 QCOMPARE(p.get_rect("key", 50, len).w, 400.0);
782 QCOMPARE(p.get_rect("key", 50, len).h, 400.0);
783 QCOMPARE(p.get_rect("key", 50, len).o, 1.0);
784 QCOMPARE(p.get_rect("key", 15, len).x, 25.8);
785 QCOMPARE(p.get_rect("key", 15, len).y, 25.8);
786 QCOMPARE(p.get_rect("key", 15, len).w, 251.6);
787 QCOMPARE(p.get_rect("key", 15, len).h, 251.6);
788 QCOMPARE(p.get_rect("key", 15, len).o, 0.258);
791 p.set("key", "0=0 0; 50=100% 200%");
792 QCOMPARE(p.get_rect("key", 25, len).x, 0.5);
793 QCOMPARE(p.get_rect("key", 25, len).y, 1.0);
798 QTEST_APPLESS_MAIN(TestProperties)
800 #include "test_properties.moc"