158 Layer &
layer = action->layer_add(
"Test Læür");
170 Slot &slot = action->slot_add();
171 strip_data0.
keyframe_insert(bmain, slot, {
"location", 0}, {1.0f, 47.0f}, settings);
172 strip_data1.
keyframe_insert(bmain, slot, {
"location", 0}, {1.0f, 48.0f}, settings);
173 strip_data2.
keyframe_insert(bmain, slot, {
"location", 0}, {1.0f, 49.0f}, settings);
174 strip_data3.
keyframe_insert(bmain, slot, {
"location", 0}, {1.0f, 50.0f}, settings);
176 EXPECT_EQ(4, action->strip_keyframe_data().size());
183 EXPECT_EQ(3, action->strip_keyframe_data().size());
196 EXPECT_EQ(2, action->strip_keyframe_data().size());
206 EXPECT_EQ(1, action->strip_keyframe_data().size());
213 EXPECT_EQ(0, action->strip_keyframe_data().size());
217 Layer &other_layer = action->layer_add(
"Another Layer");
221 <<
"Removing a strip not owned by the layer should be gracefully rejected";
342 Slot &slot = action->slot_add();
348 <<
"Removing a slot should not change the last-used slot handle.";
358 Slot &slot = action->slot_add();
364 action->layer_keystrip_ensure();
372 <<
"Removing a slot should not change the last-used slot handle.";
381 Slot &slot1 = action->slot_add();
382 Slot &slot2 = action->slot_add();
383 Slot &slot3 = action->slot_add();
393 action->layer_keystrip_ensure();
405 EXPECT_EQ(action->slot_for_handle(slot2_handle),
nullptr);
415 Slot &slot = action->slot_add_for_id(cube->id);
419 ASSERT_EQ(cube->adt->slot_handle, slot.
handle);
422 ASSERT_TRUE(action->slot_remove(slot));
423 EXPECT_EQ(cube->adt->slot_handle, removed_slot_handle);
427 action->last_slot_handle = 3;
428 Slot &slot1 = action->slot_add();
429 ASSERT_EQ(4, slot1.
handle);
430 ASSERT_EQ(4, action->last_slot_handle);
431 ASSERT_TRUE(action->slot_remove(slot1));
433 Slot &slot2 = action->slot_add();
441 Slot &slot_a = action->slot_add_for_id_type(
ID_ME);
442 Slot &slot_b = action->slot_add_for_id_type(
ID_CA);
443 Slot &slot_cube = action->slot_add_for_id(cube->id);
444 Slot &slot_suzanne = action->slot_add_for_id(suzanne->id);
454 ASSERT_EQ(action->slot(0)->handle, handle_a);
455 ASSERT_EQ(action->slot(0)->idtype_string(),
"ME");
456 ASSERT_EQ(action->slot(1)->handle, handle_b);
457 ASSERT_EQ(action->slot(1)->idtype_string(),
"CA");
458 ASSERT_EQ(action->slot(2)->handle, handle_cube);
459 ASSERT_EQ(action->slot(2)->idtype_string(),
"OB");
460 ASSERT_EQ(action->slot(2)->users(*bmain)[0], &cube->id);
461 ASSERT_EQ(action->slot(3)->handle, handle_suzanne);
462 ASSERT_EQ(action->slot(3)->idtype_string(),
"OB");
463 ASSERT_EQ(action->slot(3)->users(*bmain)[0], &suzanne->id);
466 action->slot_move_to_index(slot_b, 1);
467 EXPECT_EQ(action->slot(0)->handle, handle_a);
468 EXPECT_EQ(action->slot(0)->idtype_string(),
"ME");
469 EXPECT_EQ(action->slot(1)->handle, handle_b);
470 EXPECT_EQ(action->slot(1)->idtype_string(),
"CA");
471 EXPECT_EQ(action->slot(2)->handle, handle_cube);
472 EXPECT_EQ(action->slot(2)->idtype_string(),
"OB");
473 EXPECT_EQ(action->slot(2)->users(*bmain)[0], &cube->id);
474 EXPECT_EQ(action->slot(3)->handle, handle_suzanne);
475 EXPECT_EQ(action->slot(3)->idtype_string(),
"OB");
476 EXPECT_EQ(action->slot(3)->users(*bmain)[0], &suzanne->id);
480 action->slot_move_to_index(slot_a, 2);
481 EXPECT_EQ(action->slot(0)->handle, handle_b);
482 EXPECT_EQ(action->slot(0)->idtype_string(),
"CA");
483 EXPECT_EQ(action->slot(1)->handle, handle_cube);
484 EXPECT_EQ(action->slot(1)->idtype_string(),
"OB");
485 EXPECT_EQ(action->slot(1)->users(*bmain)[0], &cube->id);
486 EXPECT_EQ(action->slot(2)->handle, handle_a);
487 EXPECT_EQ(action->slot(2)->idtype_string(),
"ME");
488 EXPECT_EQ(action->slot(3)->handle, handle_suzanne);
489 EXPECT_EQ(action->slot(3)->idtype_string(),
"OB");
490 EXPECT_EQ(action->slot(3)->users(*bmain)[0], &suzanne->id);
492 action->slot_move_to_index(slot_suzanne, 1);
493 EXPECT_EQ(action->slot(0)->handle, handle_b);
494 EXPECT_EQ(action->slot(0)->idtype_string(),
"CA");
495 EXPECT_EQ(action->slot(1)->handle, handle_suzanne);
496 EXPECT_EQ(action->slot(1)->idtype_string(),
"OB");
497 EXPECT_EQ(action->slot(1)->users(*bmain)[0], &suzanne->id);
498 EXPECT_EQ(action->slot(2)->handle, handle_cube);
499 EXPECT_EQ(action->slot(2)->idtype_string(),
"OB");
500 EXPECT_EQ(action->slot(2)->users(*bmain)[0], &cube->id);
501 EXPECT_EQ(action->slot(3)->handle, handle_a);
502 EXPECT_EQ(action->slot(3)->idtype_string(),
"ME");
504 action->slot_move_to_index(slot_cube, 3);
505 EXPECT_EQ(action->slot(0)->handle, handle_b);
506 EXPECT_EQ(action->slot(0)->idtype_string(),
"CA");
507 EXPECT_EQ(action->slot(1)->handle, handle_suzanne);
508 EXPECT_EQ(action->slot(1)->idtype_string(),
"OB");
509 EXPECT_EQ(action->slot(1)->users(*bmain)[0], &suzanne->id);
510 EXPECT_EQ(action->slot(2)->handle, handle_a);
511 EXPECT_EQ(action->slot(2)->idtype_string(),
"ME");
512 EXPECT_EQ(action->slot(3)->handle, handle_cube);
513 EXPECT_EQ(action->slot(3)->idtype_string(),
"OB");
514 EXPECT_EQ(action->slot(3)->users(*bmain)[0], &cube->id);
516 action->slot_move_to_index(slot_suzanne, 0);
517 EXPECT_EQ(action->slot(0)->handle, handle_suzanne);
518 EXPECT_EQ(action->slot(0)->idtype_string(),
"OB");
519 EXPECT_EQ(action->slot(0)->users(*bmain)[0], &suzanne->id);
520 EXPECT_EQ(action->slot(1)->handle, handle_b);
521 EXPECT_EQ(action->slot(1)->idtype_string(),
"CA");
522 EXPECT_EQ(action->slot(2)->handle, handle_a);
523 EXPECT_EQ(action->slot(2)->idtype_string(),
"ME");
524 EXPECT_EQ(action->slot(3)->handle, handle_cube);
525 EXPECT_EQ(action->slot(3)->idtype_string(),
"OB");
526 EXPECT_EQ(action->slot(3)->users(*bmain)[0], &cube->id);
532 Slot &slot_cube = action->slot_add();
533 ASSERT_NE(
nullptr, slot_cube.
runtime);
539 EXPECT_STREQ(slot_cube.
identifier, cube->adt->last_slot_identifier)
540 <<
"The slot identifier should be copied to the adt";
543 <<
"Expecting Cube to be registered as animated by its slot.";
549 EXPECT_STREQ(slot_cube.
identifier, cube->adt->last_slot_identifier)
550 <<
"The slot identifier should be copied to the adt";
553 <<
"Expecting Suzanne to be registered as animated by the Cube slot.";
561 <<
"Expecting Cube to no longer be registered as user of its old slot.";
563 <<
"Expecting Cube to be registered as user of its new slot.";
569 const int user_count_pre = action->id.us;
570 Slot &slot_cube_2 = action->slot_add();
573 ASSERT_EQ(action->id.us, user_count_pre)
574 <<
"Assigning to a different slot of the same Action should _not_ change the user "
575 "count of that Action";
577 <<
"Expecting Cube to no longer be registered as animated by the Cube slot.";
579 <<
"Expecting Cube to be registered as animated by the 'cube_2' slot.";
583 const int user_count_pre = action->id.us;
585 ASSERT_EQ(action->id.us, user_count_pre - 1)
586 <<
"Unassigning an Action should lower its user count";
588 ASSERT_EQ(2, action->slots().size()) <<
"Expecting the Action to have two Slots";
589 EXPECT_FALSE(action->slot(0)->users(*bmain).contains(&cube->id))
590 <<
"Expecting Cube to no longer be registered as animated by any slot.";
591 EXPECT_FALSE(action->slot(1)->users(*bmain).contains(&cube->id))
592 <<
"Expecting Cube to no longer be registered as animated by any slot.";
597 Slot &another_slot_cube = action->slot_add();
601 EXPECT_STREQ(
"OBSlot.002", another_slot_cube.
identifier) <<
"The slot should be uniquely named";
602 EXPECT_STREQ(
"OBSlot.002", cube->adt->last_slot_identifier)
603 <<
"The slot identifier should be copied to the adt";
605 <<
"Expecting Cube to be registered as animated by the 'another_slot_cube' slot.";
611 <<
"Mesh should not be animatable by an Object slot";
613 <<
"Expecting Mesh to not be registered as animated by the 'slot_cube' slot.";
1030 Slot &slot_cube = action->slot_add();
1045 ASSERT_EQ(action->layer_array_num, 1);
1048 Layer *layer_1 = action->layer(0);
1066 move_slot(*bmain, slot_suzanne, *action_2, *action);
1071 ASSERT_EQ(action->slot_array_num, 2);
1075 ASSERT_EQ(action, cube->adt->action);
1076 ASSERT_EQ(action, suzanne->adt->action);
1084 Slot &slot_cube = action->slot_add();
1099 ASSERT_EQ(action->layer_array_num, 1);
1102 Layer *layer_1 = action->layer(0);
1113 <<
"the keyframe strip of action_2 should NOT have a channelbag in this test";
1118 move_slot(*bmain, slot_suzanne, *action_2, *action);
1123 ASSERT_EQ(action->slot_array_num, 2);
1127 ASSERT_EQ(action, cube->adt->action);
1128 ASSERT_EQ(action, suzanne->adt->action);
1418 FCurve &existing1 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0, {}, {},
"group0"});
1419 FCurve &existing2 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 1, {}, {},
"group0"});
1420 FCurve &existing3 = channelbag->fcurve_ensure(
nullptr, {
"fcu1", 1, {}, {},
"group1"});
1421 FCurve &existing4 = channelbag->fcurve_ensure(
nullptr, {
"fcu_", 0});
1422 ASSERT_EQ(2, channelbag->channel_groups().size());
1423 ASSERT_EQ(4, channelbag->fcurves().size());
1427 {
"fcu2", 0, {}, {},
"group2"},
1428 {
"fcu2", 1, {}, {},
"group2"},
1429 {
"fcu2", 2, {}, {},
"group2"},
1431 {
"fcu3", 0, {}, {},
"group1"},
1432 {
"fcu4", 0, {}, {},
"group0"},
1433 {
"fcu5", 0, {}, {},
"group1"},
1434 {
"fcu6", 0, {}, {},
"group0"},
1435 {
"fcu7", 0, {}, {},
"group2"},
1440 {
"", 0, {}, {},
"irrelevant"},
1442 {
"fcu0", 1, {}, {},
"irrelevant"},
1443 {
"fcu5", 0, {}, {},
"also unused"},
1444 {
"fcu2", 0, {}, {},
"group2"},
1448 ASSERT_EQ(15, fcurves.
size());
1450 EXPECT_STREQ(
"group2", fcurves[0]->grp->name);
1451 EXPECT_STREQ(
"group2", fcurves[1]->grp->name);
1452 EXPECT_STREQ(
"group2", fcurves[2]->grp->name);
1453 EXPECT_STREQ(
"group1", fcurves[3]->grp->name);
1454 EXPECT_STREQ(
"group0", fcurves[4]->grp->name);
1455 EXPECT_STREQ(
"group1", fcurves[5]->grp->name);
1456 EXPECT_STREQ(
"group0", fcurves[6]->grp->name);
1457 EXPECT_STREQ(
"group2", fcurves[7]->grp->name);
1466 EXPECT_EQ(3, channelbag->channel_groups().size());
1467 EXPECT_EQ(14, channelbag->fcurves().size());
1469 EXPECT_STREQ(
"group0", existing1.
grp->
name);
1470 EXPECT_STREQ(
"group0", existing2.
grp->
name);
1471 EXPECT_STREQ(
"group1", existing3.
grp->
name);
1477 FCurve &fcu0 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0, {}, {},
"group0"});
1478 FCurve &fcu1 = channelbag->fcurve_ensure(
nullptr, {
"fcu1", 0, {}, {},
"group0"});
1479 FCurve &fcu2 = channelbag->fcurve_ensure(
nullptr, {
"fcu2", 0, {}, {},
"group1"});
1480 FCurve &fcu3 = channelbag->fcurve_ensure(
nullptr, {
"fcu3", 0, {}, {},
"group1"});
1481 FCurve &fcu4 = channelbag->fcurve_ensure(
nullptr, {
"fcu4", 0});
1483 ASSERT_EQ(5, channelbag->fcurves().size());
1484 ASSERT_EQ(2, channelbag->channel_groups().size());
1490 channelbag->fcurve_move_to_index(fcu0, 0);
1491 EXPECT_EQ(&fcu0, channelbag->fcurve(0));
1492 EXPECT_EQ(&fcu1, channelbag->fcurve(1));
1493 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
1494 EXPECT_EQ(&fcu3, channelbag->fcurve(3));
1495 EXPECT_EQ(&fcu4, channelbag->fcurve(4));
1503 channelbag->fcurve_move_to_index(fcu4, 0);
1508 EXPECT_EQ(&fcu4, channelbag->fcurve(0));
1509 EXPECT_EQ(&fcu0, channelbag->fcurve(1));
1510 EXPECT_EQ(&fcu1, channelbag->fcurve(2));
1511 EXPECT_EQ(&fcu2, channelbag->fcurve(3));
1512 EXPECT_EQ(&fcu3, channelbag->fcurve(4));
1520 channelbag->fcurve_move_to_index(fcu1, 4);
1525 EXPECT_EQ(&fcu4, channelbag->fcurve(0));
1526 EXPECT_EQ(&fcu0, channelbag->fcurve(1));
1527 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
1528 EXPECT_EQ(&fcu3, channelbag->fcurve(3));
1529 EXPECT_EQ(&fcu1, channelbag->fcurve(4));
1537 channelbag->fcurve_move_to_index(fcu4, 2);
1542 EXPECT_EQ(&fcu0, channelbag->fcurve(0));
1543 EXPECT_EQ(&fcu2, channelbag->fcurve(1));
1544 EXPECT_EQ(&fcu4, channelbag->fcurve(2));
1545 EXPECT_EQ(&fcu3, channelbag->fcurve(3));
1546 EXPECT_EQ(&fcu1, channelbag->fcurve(4));
1591 bActionGroup &group0 = channelbag->channel_group_create(
"Group0");
1592 bActionGroup &group1 = channelbag->channel_group_create(
"Group1");
1593 bActionGroup &group2 = channelbag->channel_group_create(
"Group2");
1595 FCurve &fcu0 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0, {}, {},
"Group0"});
1596 FCurve &fcu1 = channelbag->fcurve_ensure(
nullptr, {
"fcu1", 0, {}, {},
"Group0"});
1597 FCurve &fcu2 = channelbag->fcurve_ensure(
nullptr, {
"fcu2", 0, {}, {},
"Group2"});
1598 FCurve &fcu3 = channelbag->fcurve_ensure(
nullptr, {
"fcu3", 0, {}, {},
"Group2"});
1599 FCurve &fcu4 = channelbag->fcurve_ensure(
nullptr, {
"fcu4", 0});
1601 ASSERT_EQ(3, channelbag->channel_groups().size());
1602 ASSERT_EQ(5, channelbag->fcurves().size());
1607 EXPECT_EQ(
false, channelbag->channel_group_remove(bogus));
1608 ASSERT_EQ(3, channelbag->channel_groups().size());
1609 ASSERT_EQ(5, channelbag->fcurves().size());
1610 EXPECT_EQ(&group0, channelbag->channel_group(0));
1611 EXPECT_EQ(&group1, channelbag->channel_group(1));
1612 EXPECT_EQ(&group2, channelbag->channel_group(2));
1613 EXPECT_EQ(&fcu0, channelbag->fcurve(0));
1614 EXPECT_EQ(&fcu1, channelbag->fcurve(1));
1615 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
1616 EXPECT_EQ(&fcu3, channelbag->fcurve(3));
1617 EXPECT_EQ(&fcu4, channelbag->fcurve(4));
1625 EXPECT_EQ(
true, channelbag->channel_group_remove(group1));
1626 ASSERT_EQ(2, channelbag->channel_groups().size());
1627 ASSERT_EQ(5, channelbag->fcurves().size());
1628 EXPECT_EQ(&group0, channelbag->channel_group(0));
1629 EXPECT_EQ(&group2, channelbag->channel_group(1));
1630 EXPECT_EQ(&fcu0, channelbag->fcurve(0));
1631 EXPECT_EQ(&fcu1, channelbag->fcurve(1));
1632 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
1633 EXPECT_EQ(&fcu3, channelbag->fcurve(3));
1634 EXPECT_EQ(&fcu4, channelbag->fcurve(4));
1643 EXPECT_EQ(
true, channelbag->channel_group_remove(group0));
1644 ASSERT_EQ(1, channelbag->channel_groups().size());
1645 ASSERT_EQ(5, channelbag->fcurves().size());
1646 EXPECT_EQ(&group2, channelbag->channel_group(0));
1647 EXPECT_EQ(&fcu2, channelbag->fcurve(0));
1648 EXPECT_EQ(&fcu3, channelbag->fcurve(1));
1649 EXPECT_EQ(&fcu0, channelbag->fcurve(2));
1650 EXPECT_EQ(&fcu1, channelbag->fcurve(3));
1651 EXPECT_EQ(&fcu4, channelbag->fcurve(4));
1660 EXPECT_EQ(
true, channelbag->channel_group_remove(group2));
1661 ASSERT_EQ(0, channelbag->channel_groups().size());
1662 ASSERT_EQ(5, channelbag->fcurves().size());
1663 EXPECT_EQ(&fcu2, channelbag->fcurve(0));
1664 EXPECT_EQ(&fcu3, channelbag->fcurve(1));
1665 EXPECT_EQ(&fcu0, channelbag->fcurve(2));
1666 EXPECT_EQ(&fcu1, channelbag->fcurve(3));
1667 EXPECT_EQ(&fcu4, channelbag->fcurve(4));
1711 FCurve &fcu0 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0});
1712 EXPECT_EQ(1, channelbag->fcurves().size());
1713 EXPECT_TRUE(channelbag->channel_groups().is_empty());
1718 channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0, {}, {},
"group0"});
1719 EXPECT_EQ(1, channelbag->fcurves().size());
1721 EXPECT_TRUE(channelbag->channel_groups().is_empty());
1726 FCurve &fcu1 = channelbag->fcurve_ensure(
nullptr, {
"fcu1", 0, {}, {},
"group0"});
1727 ASSERT_EQ(2, channelbag->fcurves().size());
1728 ASSERT_EQ(1, channelbag->channel_groups().size());
1730 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
1731 EXPECT_EQ(&fcu0, channelbag->fcurve(1));
1741 FCurve &fcu2 = channelbag->fcurve_ensure(
nullptr, {
"fcu2", 0, {}, {},
"group1"});
1742 ASSERT_EQ(3, channelbag->fcurves().size());
1743 ASSERT_EQ(2, channelbag->channel_groups().size());
1744 EXPECT_EQ(&group0, channelbag->channel_group(0));
1746 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
1747 EXPECT_EQ(&fcu2, channelbag->fcurve(1));
1748 EXPECT_EQ(&fcu0, channelbag->fcurve(2));
1759 FCurve &fcu3 = channelbag->fcurve_ensure(
nullptr, {
"fcu3", 0, {}, {},
"group0"});
1760 ASSERT_EQ(4, channelbag->fcurves().size());
1761 ASSERT_EQ(2, channelbag->channel_groups().size());
1762 EXPECT_EQ(&group0, channelbag->channel_group(0));
1763 EXPECT_EQ(&group1, channelbag->channel_group(1));
1764 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
1765 EXPECT_EQ(&fcu3, channelbag->fcurve(1));
1766 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
1767 EXPECT_EQ(&fcu0, channelbag->fcurve(3));
1779 FCurve &fcu4 = channelbag->fcurve_ensure(
nullptr, {
"fcu4", 0, {}, {},
"group1"});
1780 ASSERT_EQ(5, channelbag->fcurves().size());
1781 ASSERT_EQ(2, channelbag->channel_groups().size());
1782 EXPECT_EQ(&group0, channelbag->channel_group(0));
1783 EXPECT_EQ(&group1, channelbag->channel_group(1));
1784 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
1785 EXPECT_EQ(&fcu3, channelbag->fcurve(1));
1786 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
1787 EXPECT_EQ(&fcu4, channelbag->fcurve(3));
1788 EXPECT_EQ(&fcu0, channelbag->fcurve(4));
1802 FCurve &fcu0 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0, {}, {},
"group0"});
1803 FCurve &fcu1 = channelbag->fcurve_ensure(
nullptr, {
"fcu1", 0, {}, {},
"group0"});
1804 FCurve &fcu2 = channelbag->fcurve_ensure(
nullptr, {
"fcu2", 0, {}, {},
"group1"});
1805 FCurve &fcu3 = channelbag->fcurve_ensure(
nullptr, {
"fcu3", 0, {}, {},
"group1"});
1806 FCurve &fcu4 = channelbag->fcurve_ensure(
nullptr, {
"fcu4", 0});
1808 ASSERT_EQ(5, channelbag->fcurves().size());
1809 ASSERT_EQ(2, channelbag->channel_groups().size());
1824 channelbag->fcurve_remove(fcu3);
1825 ASSERT_EQ(4, channelbag->fcurves().size());
1826 ASSERT_EQ(2, channelbag->channel_groups().size());
1827 EXPECT_EQ(&group0, channelbag->channel_group(0));
1828 EXPECT_EQ(&group1, channelbag->channel_group(1));
1838 channelbag->fcurve_remove(fcu0);
1839 ASSERT_EQ(3, channelbag->fcurves().size());
1840 ASSERT_EQ(2, channelbag->channel_groups().size());
1841 EXPECT_EQ(&group0, channelbag->channel_group(0));
1842 EXPECT_EQ(&group1, channelbag->channel_group(1));
1851 channelbag->fcurve_remove(fcu1);
1852 ASSERT_EQ(2, channelbag->fcurves().size());
1853 ASSERT_EQ(1, channelbag->channel_groups().size());
1854 EXPECT_EQ(&group1, channelbag->channel_group(0));
1860 channelbag->fcurve_remove(fcu4);
1861 ASSERT_EQ(1, channelbag->fcurves().size());
1862 ASSERT_EQ(1, channelbag->channel_groups().size());
1863 EXPECT_EQ(&group1, channelbag->channel_group(0));
1868 channelbag->fcurve_remove(fcu2);
1869 ASSERT_EQ(0, channelbag->fcurves().size());
1870 ASSERT_EQ(0, channelbag->channel_groups().size());
1875 FCurve &fcu0 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0, {}, {},
"group0"});
1876 FCurve &fcu1 = channelbag->fcurve_ensure(
nullptr, {
"fcu1", 0, {}, {},
"group1"});
1877 FCurve &fcu2 = channelbag->fcurve_ensure(
nullptr, {
"fcu2", 0, {}, {},
"group1"});
1878 FCurve &fcu3 = channelbag->fcurve_ensure(
nullptr, {
"fcu3", 0, {}, {},
"group2"});
1879 FCurve &fcu4 = channelbag->fcurve_ensure(
nullptr, {
"fcu4", 0});
1881 ASSERT_EQ(5, channelbag->fcurves().size());
1882 ASSERT_EQ(3, channelbag->channel_groups().size());
1888 channelbag->channel_group_move_to_index(group0, 2);
1889 EXPECT_EQ(&group1, channelbag->channel_group(0));
1890 EXPECT_EQ(&group2, channelbag->channel_group(1));
1891 EXPECT_EQ(&group0, channelbag->channel_group(2));
1898 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
1899 EXPECT_EQ(&fcu2, channelbag->fcurve(1));
1900 EXPECT_EQ(&fcu3, channelbag->fcurve(2));
1901 EXPECT_EQ(&fcu0, channelbag->fcurve(3));
1902 EXPECT_EQ(&fcu4, channelbag->fcurve(4));
1909 channelbag->channel_group_move_to_index(group1, 1);
1910 EXPECT_EQ(&group2, channelbag->channel_group(0));
1911 EXPECT_EQ(&group1, channelbag->channel_group(1));
1912 EXPECT_EQ(&group0, channelbag->channel_group(2));
1919 EXPECT_EQ(&fcu3, channelbag->fcurve(0));
1920 EXPECT_EQ(&fcu1, channelbag->fcurve(1));
1921 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
1922 EXPECT_EQ(&fcu0, channelbag->fcurve(3));
1923 EXPECT_EQ(&fcu4, channelbag->fcurve(4));
1930 channelbag->channel_group_move_to_index(group0, 0);
1931 EXPECT_EQ(&group0, channelbag->channel_group(0));
1932 EXPECT_EQ(&group2, channelbag->channel_group(1));
1933 EXPECT_EQ(&group1, channelbag->channel_group(2));
1940 EXPECT_EQ(&fcu0, channelbag->fcurve(0));
1941 EXPECT_EQ(&fcu3, channelbag->fcurve(1));
1942 EXPECT_EQ(&fcu1, channelbag->fcurve(2));
1943 EXPECT_EQ(&fcu2, channelbag->fcurve(3));
1944 EXPECT_EQ(&fcu4, channelbag->fcurve(4));
1954 FCurve &fcu0 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0});
1955 FCurve &fcu1 = channelbag->fcurve_ensure(
nullptr, {
"fcu1", 0});
1956 FCurve &fcu2 = channelbag->fcurve_ensure(
nullptr, {
"fcu2", 0});
1957 bActionGroup &group0 = channelbag->channel_group_create(
"group0");
1958 bActionGroup &group1 = channelbag->channel_group_create(
"group1");
1960 ASSERT_EQ(3, channelbag->fcurves().size());
1961 EXPECT_EQ(&fcu0, channelbag->fcurve(0));
1962 EXPECT_EQ(&fcu1, channelbag->fcurve(1));
1963 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
1964 ASSERT_EQ(2, channelbag->channel_groups().size());
1965 EXPECT_EQ(&group0, channelbag->channel_group(0));
1966 EXPECT_EQ(&group1, channelbag->channel_group(1));
1972 channelbag->fcurve_assign_to_channel_group(fcu2, group1);
1973 EXPECT_EQ(&fcu2, channelbag->fcurve(0));
1974 EXPECT_EQ(&fcu0, channelbag->fcurve(1));
1975 EXPECT_EQ(&fcu1, channelbag->fcurve(2));
1981 channelbag->fcurve_assign_to_channel_group(fcu1, group0);
1982 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
1983 EXPECT_EQ(&fcu2, channelbag->fcurve(1));
1984 EXPECT_EQ(&fcu0, channelbag->fcurve(2));
1990 channelbag->fcurve_assign_to_channel_group(fcu0, group1);
1991 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
1992 EXPECT_EQ(&fcu2, channelbag->fcurve(1));
1993 EXPECT_EQ(&fcu0, channelbag->fcurve(2));
1999 channelbag->fcurve_assign_to_channel_group(fcu0, group0);
2000 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
2001 EXPECT_EQ(&fcu0, channelbag->fcurve(1));
2002 EXPECT_EQ(&fcu2, channelbag->fcurve(2));
2008 channelbag->fcurve_assign_to_channel_group(fcu1, group1);
2009 EXPECT_EQ(&fcu0, channelbag->fcurve(0));
2010 EXPECT_EQ(&fcu2, channelbag->fcurve(1));
2011 EXPECT_EQ(&fcu1, channelbag->fcurve(2));
2020 FCurve &fcu0 = channelbag->fcurve_ensure(
nullptr, {
"fcu0", 0, {}, {},
"group0"});
2021 FCurve &fcu1 = channelbag->fcurve_ensure(
nullptr, {
"fcu1", 0, {}, {},
"group0"});
2022 FCurve &fcu2 = channelbag->fcurve_ensure(
nullptr, {
"fcu2", 0, {}, {},
"group1"});
2023 FCurve &fcu3 = channelbag->fcurve_ensure(
nullptr, {
"fcu3", 0, {}, {},
"group1"});
2024 FCurve &fcu4 = channelbag->fcurve_ensure(
nullptr, {
"fcu4", 0});
2026 ASSERT_EQ(5, channelbag->fcurves().size());
2027 ASSERT_EQ(2, channelbag->channel_groups().size());
2046 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
2047 EXPECT_EQ(&fcu2, channelbag->fcurve(1));
2048 EXPECT_EQ(&fcu3, channelbag->fcurve(2));
2049 EXPECT_EQ(&fcu4, channelbag->fcurve(3));
2050 EXPECT_EQ(&fcu0, channelbag->fcurve(4));
2062 EXPECT_EQ(&fcu1, channelbag->fcurve(0));
2063 EXPECT_EQ(&fcu2, channelbag->fcurve(1));
2064 EXPECT_EQ(&fcu4, channelbag->fcurve(2));
2065 EXPECT_EQ(&fcu0, channelbag->fcurve(3));
2066 EXPECT_EQ(&fcu3, channelbag->fcurve(4));
2074 EXPECT_EQ(1, channelbag->channel_groups().size());
2075 EXPECT_EQ(&group1, channelbag->channel_group(0));
2078 EXPECT_EQ(&fcu2, channelbag->fcurve(0));
2079 EXPECT_EQ(&fcu4, channelbag->fcurve(1));
2080 EXPECT_EQ(&fcu0, channelbag->fcurve(2));
2081 EXPECT_EQ(&fcu3, channelbag->fcurve(3));
2082 EXPECT_EQ(&fcu1, channelbag->fcurve(4));
2090 EXPECT_EQ(0, channelbag->channel_groups().size());
2091 EXPECT_EQ(&fcu4, channelbag->fcurve(0));
2092 EXPECT_EQ(&fcu0, channelbag->fcurve(1));
2093 EXPECT_EQ(&fcu3, channelbag->fcurve(2));
2094 EXPECT_EQ(&fcu1, channelbag->fcurve(3));
2095 EXPECT_EQ(&fcu2, channelbag->fcurve(4));
2133 FCurve &fcurve_to_move = cbag_src.fcurve_ensure(this->bmain, {
"source_prop", 2});
2134 bActionGroup &group_src = cbag_src.channel_group_create(
"Gröpje");
2135 cbag_src.fcurve_assign_to_channel_group(fcurve_to_move, group_src);
2148 EXPECT_EQ(
nullptr, cbag_src.fcurve_find({fcurve_to_move.rna_path(), fcurve_to_move.array_index}))
2149 <<
"F-Curve should no longer exist in source Action";
2151 cbag_dst.fcurve_find({fcurve_to_move.rna_path(), fcurve_to_move.array_index}))
2152 <<
"F-Curve should exist in destination Action";
2154 EXPECT_EQ(1, cbag_src.fcurves().size()) <<
"Source Action should still have the other F-Curve";
2156 <<
"Destination Action should have its original and the moved F-Curve";
2158 bActionGroup *group_dst = cbag_dst.channel_group_find(
"Gröpje");
2159 ASSERT_NE(
nullptr, group_dst) <<
"Expected channel group to be created";
2160 ASSERT_EQ(group_dst, fcurve_to_move.
grp) <<
"Expected group membership to move as well";