public void Redo_NoDestSuppliedMoveAllCharactersFromSourceWithAssignedActor_CharactersGetMovedBackToOriginalGroupAndNewGroupIsRemoved()
        {
            var actor = new Glyssen.VoiceActor.VoiceActor {
                Id = 13
            };

            m_testProject.VoiceActorList.AllActors.Add(actor);
            var charactersToMove = new[] { "Peter (Simon)", "John the Baptist", "rich young ruler", "centurion at crucifixion", "man possessed by evil spirit", "John", "Pharisees" };
            var sourceGroup      = AddCharacterGroup(charactersToMove);

            sourceGroup.AssignVoiceActor(13);
            var action = new MoveCharactersToGroupUndoAction(m_testProject, sourceGroup, null, new List <string>(sourceGroup.CharacterIds));

            Assert.IsTrue(action.Undo());
            var estHoursOfSourceBeforeRedo = sourceGroup.EstimatedHours;

            Assert.IsTrue(action.Redo());

            var newGroup = m_testProject.CharacterGroupList.GroupContainingCharacterId("rich young ruler");

            Assert.IsTrue(action.GroupsAffectedByLastOperation.SequenceEqual(new[] { newGroup, sourceGroup }));
            Assert.AreNotEqual(sourceGroup, newGroup);
            Assert.IsTrue(newGroup.CharacterIds.SetEquals(charactersToMove));
            Assert.AreEqual(0, sourceGroup.CharacterIds.Count);
            Assert.AreEqual(13, sourceGroup.VoiceActorId);
            Assert.IsTrue(estHoursOfSourceBeforeRedo > sourceGroup.EstimatedHours);
        }
Beispiel #2
0
        public void IsVoiceActorAssignmentsComplete_GroupWithNoActor_ReturnsFalse()
        {
            var project = TestProject.CreateBasicTestProject();

            var actor = new Glyssen.VoiceActor.VoiceActor();

            project.VoiceActorList.Actors.Add(actor);
            var group = new CharacterGroup(project);

            project.CharacterGroupList.CharacterGroups.Add(group);

            Assert.False(project.IsVoiceActorAssignmentsComplete);
        }
Beispiel #3
0
        public void IsVoiceActorAssignmentsComplete_Complete_ReturnsTrue()
        {
            var project = TestProject.CreateBasicTestProject();

            var actor = new Glyssen.VoiceActor.VoiceActor();

            project.VoiceActorList.Actors.Add(actor);
            var group = new CharacterGroup(project);

            group.AssignVoiceActor(actor.Id);
            project.CharacterGroupList.CharacterGroups.Add(group);

            Assert.True(project.IsVoiceActorAssignmentsComplete);
        }
Beispiel #4
0
        public void HasUnusedActor_NoUnusedActor_ReturnsFalse()
        {
            var project = TestProject.CreateBasicTestProject();

            var actor1 = new Glyssen.VoiceActor.VoiceActor();

            project.VoiceActorList.Actors.Add(actor1);
            var group = new CharacterGroup(project);

            group.AssignVoiceActor(actor1.Id);
            project.CharacterGroupList.CharacterGroups.Add(group);

            Assert.True(project.CharacterGroupList.AnyVoiceActorAssigned());
            Assert.False(project.HasUnusedActor);
        }
Beispiel #5
0
        public void EveryAssignedGroupHasACharacter_AssignedGroupWithNoCharacter_ReturnsFalse()
        {
            var project = TestProject.CreateBasicTestProject();

            var actor = new Glyssen.VoiceActor.VoiceActor();

            project.VoiceActorList.Actors.Add(actor);
            var group = new CharacterGroup(project);

            group.AssignVoiceActor(actor.Id);
            project.CharacterGroupList.CharacterGroups.Add(group);

            Assert.True(project.CharacterGroupList.AnyVoiceActorAssigned());
            Assert.False(project.EveryAssignedGroupHasACharacter);
        }
        public void SetInactive_PreviouslyInactiveSetToInactive_NoChange()
        {
            var actor = new Glyssen.VoiceActor.VoiceActor {
                Id = 5, Name = "Gubaru", IsInactive = true
            };

            m_testProject.VoiceActorList.AllActors.Add(actor);
            var characterGroup = new CharacterGroup(m_testProject);

            m_testProject.CharacterGroupList.CharacterGroups.Add(characterGroup);
            Assert.True(actor.IsInactive);
            Assert.False(m_testProject.CharacterGroupList.HasVoiceActorAssigned(actor.Id));

            m_model.SetInactive(actor, true);
            Assert.True(actor.IsInactive);
            Assert.False(m_testProject.CharacterGroupList.HasVoiceActorAssigned(actor.Id));
        }
Beispiel #7
0
        public void SetGroupIdLabelBasedOnCharacterIds_CameoActorAssigned_GroupIdLabelIsOtherAndTextSet()
        {
            var actor = new Glyssen.VoiceActor.VoiceActor {
                Id = 1, Name = "Cameo Name", IsCameo = true
            };

            m_project.VoiceActorList.AllActors.Add(actor);
            var group = new CharacterGroup(m_project);

            group.CharacterIds.Add("Andrew");
            group.AssignVoiceActor(actor.Id);
            group.SetGroupIdLabel();
            Assert.AreEqual(CharacterGroup.Label.Other, group.GroupIdLabel);
            Assert.AreEqual(0, group.GroupIdNumber);
            Assert.AreEqual("Cameo Name", group.GroupId);
            Assert.AreEqual("Cameo Name", group.GroupIdForUiDisplay);
        }
        public void Undo_AssignCameoRole_CameoGroupNotRemoved()
        {
            // list of characters
            var originalCharactersInSource = new[] { "Peter (Simon)", "woman, bleeding for twelve years" };
            var sourceGroup = AddCharacterGroup(originalCharactersInSource);

            // set up cameo actor and group
            var cameoActor = new Glyssen.VoiceActor.VoiceActor {
                Id = 1, Name = "Missy Cameo", IsCameo = true
            };

            m_testProject.VoiceActorList.AllActors.Add(cameoActor);
            var cameoGroup = AddCharacterGroup();

            cameoGroup.AssignVoiceActor(1);

            // should be 2 groups now
            Assert.AreEqual(2, m_testProject.CharacterGroupList.CharacterGroups.Count);

            var estHoursOfSourceBeforeMove = sourceGroup.EstimatedHours;

            Assert.AreEqual(0, cameoGroup.EstimatedHours);

            // assign the character role "woman, bleeding for twelve years" to the cameo actor
            var action = new MoveCharactersToGroupUndoAction(m_testProject, sourceGroup, cameoGroup, new List <string> {
                "woman, bleeding for twelve years"
            });

            // should still be 2 groups
            Assert.AreEqual(2, m_testProject.CharacterGroupList.CharacterGroups.Count);

            // "woman, bleeding for twelve years" should be in the cameo group now
            Assert.IsTrue(m_testProject.CharacterGroupList.GroupContainingCharacterId("woman, bleeding for twelve years").AssignedToCameoActor);

            // undo
            Assert.IsTrue(action.Undo());

            // should still be 2 groups
            Assert.AreEqual(2, m_testProject.CharacterGroupList.CharacterGroups.Count);

            // "woman, bleeding for twelve years" should be back in the original group
            Assert.IsFalse(m_testProject.CharacterGroupList.GroupContainingCharacterId("woman, bleeding for twelve years").AssignedToCameoActor);
            Assert.AreEqual(estHoursOfSourceBeforeMove, sourceGroup.EstimatedHours);
            Assert.AreEqual(0, cameoGroup.EstimatedHours);
        }
        public void FixtureSetup()
        {
            m_testProject = TestProject.CreateTestProject(TestProject.TestBook.MRK);
            var actor1 = new Glyssen.VoiceActor.VoiceActor {
                Id = 1, Name = "Oneyda Figueroa"
            };
            var actor2 = new Glyssen.VoiceActor.VoiceActor {
                Id = 2, Name = "Paul Twomey"
            };
            var actor3 = new Glyssen.VoiceActor.VoiceActor {
                Id = 3, Name = "Threesa Hawkins"
            };

            m_testProject.VoiceActorList.AllActors = new List <Glyssen.VoiceActor.VoiceActor> {
                actor1, actor2, actor3
            };

            AddCharacterGroup("Jesus");
        }
        public void FixtureSetup()
        {
            m_testProject      = TestProject.CreateTestProject(TestProject.TestBook.MRK);
            m_priorityComparer = new CharacterByKeyStrokeComparer(m_testProject.GetKeyStrokesByCharacterId());
            var actor1 = new Glyssen.VoiceActor.VoiceActor {
                Id = 1, Name = "Oneyda Figueroa"
            };
            var actor2 = new Glyssen.VoiceActor.VoiceActor {
                Id = 2, Name = "Paul Twomey"
            };
            var actor3 = new Glyssen.VoiceActor.VoiceActor {
                Id = 3, Name = "Threesa Hawkins"
            };

            m_testProject.VoiceActorList.Actors = new List <Glyssen.VoiceActor.VoiceActor> {
                actor1, actor2, actor3
            };

            AddCharacterGroup("Jesus");
        }
        public void GetTabSeparatedLine_GetExportDataForBlock_TextBeginsMidVerse_ResultHasCorrectVerseInfo()
        {
            var block = new Block("p", 4, 3);

            block.BlockElements.Add(new ScriptText("Text of verse three, part two. "));
            block.BlockElements.Add(new Verse("4"));
            block.BlockElements.Add(new ScriptText("Text of verse four. "));
            block.BlockElements.Add(new Verse("5"));
            block.BlockElements.Add(new ScriptText("Text of verse five."));

            var actor = new Glyssen.VoiceActor.VoiceActor {
                Name = "ActorGuy1"
            };

            int textLength = "Text of verse three, part two. ".Length + "Text of verse four. ".Length + "Text of verse five.".Length;

            Assert.AreEqual("0\tp\tMRK\t4\t3\t\t\tText of verse three, part two. [4]\u00A0Text of verse four. [5]\u00A0Text of verse five.\t" + textLength,
                            ProjectExporter.GetTabSeparatedLine(ProjectExporter.GetExportDataForBlock(block, 0, "MRK").Item3));
            Assert.AreEqual("0\tActorGuy1\tp\tMRK\t4\t3\t\t\tText of verse three, part two. [4]\u00A0Text of verse four. [5]\u00A0Text of verse five.\t" + textLength,
                            ProjectExporter.GetTabSeparatedLine(ProjectExporter.GetExportDataForBlock(block, 0, "MRK", actor).Item3));
        }
Beispiel #12
0
        public void FixtureSetup()
        {
            m_testProject = TestProject.CreateTestProject(TestProject.TestBook.MRK);

            var actor1 = new Glyssen.VoiceActor.VoiceActor {
                Id = 1, Name = "Oneyda Figueroa"
            };
            var actor2 = new Glyssen.VoiceActor.VoiceActor {
                Id = 2, Name = "Paul Twomey"
            };
            var actor3 = new Glyssen.VoiceActor.VoiceActor {
                Id = 3, Name = "Threesa Hawkins"
            };

            m_testProject.VoiceActorList.AllActors = new List <Glyssen.VoiceActor.VoiceActor> {
                actor1, actor2, actor3
            };

            AddCharacterGroup("Jesus");
            AddCharacterGroup("Mary, Jesus' mother", "Rhoda", "Rahab");
            AddCharacterGroup("Moses", "Caiaphas", "centurion at crucifixion");
        }
Beispiel #13
0
        public void UnusedActors_UsedActorAndInactiveActor_ReturnsEmptyEnumeration()
        {
            var project = TestProject.CreateBasicTestProject();

            var actor1 = new Glyssen.VoiceActor.VoiceActor {
                Id = 0
            };

            project.VoiceActorList.AllActors.Add(actor1);
            var actor2 = new Glyssen.VoiceActor.VoiceActor {
                Id = 1, IsInactive = true
            };

            project.VoiceActorList.AllActors.Add(actor2);
            var group = new CharacterGroup(project);

            group.AssignVoiceActor(actor1.Id);
            project.CharacterGroupList.CharacterGroups.Add(group);

            Assert.True(project.CharacterGroupList.AnyVoiceActorAssigned());
            Assert.False(project.UnusedActors.Any());
        }
Beispiel #14
0
        public void UnusedActors_UnusedActor_ReturnsCorrectActor()
        {
            var project = TestProject.CreateBasicTestProject();

            var actor1 = new Glyssen.VoiceActor.VoiceActor {
                Id = 0
            };

            project.VoiceActorList.AllActors.Add(actor1);
            var actor2 = new Glyssen.VoiceActor.VoiceActor {
                Id = 1
            };

            project.VoiceActorList.AllActors.Add(actor2);
            var group = new CharacterGroup(project);

            group.AssignVoiceActor(actor1.Id);
            project.CharacterGroupList.CharacterGroups.Add(group);

            Assert.True(project.CharacterGroupList.AnyVoiceActorAssigned());
            Assert.AreEqual(actor2, project.UnusedActors.Single());
        }
        public void GetTabSeparatedLine_GetExportDataForBlock_VerseAndTextElements_ExpectedColumnsIncludingJoinedText()
        {
            var block = new Block("p", 4);

            block.IsParagraphStart = true;
            block.CharacterId      = "Fred";
            block.Delivery         = "With great gusto and quivering frustration";
            block.BlockElements.Add(new Verse("1"));
            block.BlockElements.Add(new ScriptText("Text of verse one. "));
            block.BlockElements.Add(new Verse("2"));
            block.BlockElements.Add(new ScriptText("Text of verse two."));

            var actor = new Glyssen.VoiceActor.VoiceActor {
                Name = "ActorGuy1"
            };

            int textLength = "Text of verse one. ".Length + "Text of verse two.".Length;

            Assert.AreEqual("0\tp\tMRK\t4\t1\tFred\tWith great gusto and quivering frustration\t[1]\u00A0Text of verse one. [2]\u00A0Text of verse two.\t" + textLength,
                            ProjectExporter.GetTabSeparatedLine(ProjectExporter.GetExportDataForBlock(block, 0, "MRK").Item3));
            Assert.AreEqual("0\tActorGuy1\tp\tMRK\t4\t1\tFred\tWith great gusto and quivering frustration\t[1]\u00A0Text of verse one. [2]\u00A0Text of verse two.\t" + textLength,
                            ProjectExporter.GetTabSeparatedLine(ProjectExporter.GetExportDataForBlock(block, 0, "MRK", actor).Item3));
        }
        public void GetTabSeparatedLine_GetExportDataForBlock_MultiCharacterWithResolvedId_OutputContainsCharacterIdToUseInScript()
        {
            var block = new Block("p", 4);

            block.IsParagraphStart    = true;
            block.CharacterId         = "Fred/Marko";
            block.CharacterIdInScript = "Marko";
            block.Delivery            = "With great gusto and quivering frustration";
            block.BlockElements.Add(new Verse("1"));
            block.BlockElements.Add(new ScriptText("Text of verse one. "));
            block.BlockElements.Add(new Verse("2"));
            block.BlockElements.Add(new ScriptText("Text of verse two."));

            var actor = new Glyssen.VoiceActor.VoiceActor {
                Name = "ActorGuy1"
            };

            int textLength = "Text of verse one. ".Length + "Text of verse two.".Length;

            Assert.AreEqual("0\tp\tMRK\t4\t1\tMarko\tWith great gusto and quivering frustration\t[1]\u00A0Text of verse one. [2]\u00A0Text of verse two.\t" + textLength,
                            ProjectExporter.GetTabSeparatedLine(ProjectExporter.GetExportDataForBlock(block, 0, "MRK").Item3));
            Assert.AreEqual("0\tActorGuy1\tp\tMRK\t4\t1\tMarko\tWith great gusto and quivering frustration\t[1]\u00A0Text of verse one. [2]\u00A0Text of verse two.\t" + textLength,
                            ProjectExporter.GetTabSeparatedLine(ProjectExporter.GetExportDataForBlock(block, 0, "MRK", actor).Item3));
        }