Esempio n. 1
0
        public void PopulateEstimatedHours()
        {
            var list   = new CharacterGroupList();
            var group1 = new CharacterGroup(m_project)
            {
                CharacterIds = { "A", "B" }
            };

            list.CharacterGroups.Add(group1);

            var group2 = new CharacterGroup(m_project)
            {
                CharacterIds = { "C", "D" }
            };

            list.CharacterGroups.Add(group2);

            var keyStrokesPerCharacter = new Dictionary <string, int>(4);

            keyStrokesPerCharacter["A"] = 3500;
            keyStrokesPerCharacter["B"] = 4000;
            keyStrokesPerCharacter["C"] = 198;
            list.PopulateEstimatedHours(keyStrokesPerCharacter);

            Assert.AreEqual((3500 + 4000d) / Program.kKeyStrokesPerHour, group1.EstimatedHours);
            Assert.AreEqual(198d / Program.kKeyStrokesPerHour, group2.EstimatedHours);
        }
Esempio n. 2
0
        public void HasVoiceActorAssigned_NoneAssigned_ReturnsFalse()
        {
            var list  = new CharacterGroupList();
            var group = new CharacterGroup(m_project);

            list.CharacterGroups.Add(group);

            Assert.IsFalse(list.HasVoiceActorAssigned(1));
        }
Esempio n. 3
0
        public void HasVoiceActorAssigned_RequestedActorAssigned_ReturnsTrue()
        {
            var list  = new CharacterGroupList();
            var group = new CharacterGroup(m_project);

            group.AssignVoiceActor(1);
            list.CharacterGroups.Add(group);

            Assert.IsTrue(list.HasVoiceActorAssigned(1));
        }
Esempio n. 4
0
        public void AnyVoiceActorAssigned_OneAssigned_ReturnsTrue()
        {
            var list  = new CharacterGroupList();
            var group = new CharacterGroup(m_project);

            group.AssignVoiceActor(0);
            list.CharacterGroups.Add(group);

            Assert.IsTrue(list.AnyVoiceActorAssigned());
        }
Esempio n. 5
0
        private void EnsureGroupsAreInSynchWithCharactersInUse()
        {
            if (!m_project.CharacterGroupList.CharacterGroups.Any())
            {
                return;
            }

            var adjuster = new CharacterGroupsAdjuster(m_project);

            if (adjuster.GroupsAreNotInSynchWithData)
            {
                using (var progressDialog = new GenerateGroupsProgressDialog(m_project, OnGenerateGroupsWorkerDoWork, false, true))
                {
                    var generator = new CharacterGroupGenerator(m_project, ProjectCastSizePlanningViewModel.SelectedCastSize, progressDialog.BackgroundWorker);
                    progressDialog.ProgressState.Arguments = generator;

                    if (progressDialog.ShowDialog() == DialogResult.OK && generator.GeneratedGroups != null)
                    {
                        var assignedBefore = m_project.CharacterGroupList.CountVoiceActorsAssigned();
                        generator.ApplyGeneratedGroupsToProject();

                        if (m_project.CharacterGroupList.CountVoiceActorsAssigned() < assignedBefore)
                        {
                            var msg = LocalizationManager.GetString("MainForm.FewerAssignedActorsAfterGeneration",
                                                                    "An actor assignment had to be removed. Please review the Voice Actor assignments, and adjust where necessary.");
                            MessageBox.Show(this, msg, Text, MessageBoxButtons.OK);
                        }
                    }
                    else
                    {
                        adjuster.MakeMinimalAdjustments();
                    }

                    m_project.Save(true);
                }
            }
            // This is for the migration of old projects.
            // ENHANCE; Theoretically, we could, before we update the controlfileversion number, set a flag
            // letting us know if this needs to run or not. It would be for any number < 96.
            // This method would be moved into Project (which maybe it should be anyway).
            // But this must be called only AFTER EnsureGroupsAreInSynchWithCharactersInUse has been run.
            if (m_project.CharacterGroupList.CharacterGroups.Any(g => g.GroupIdLabel == CharacterGroup.Label.None))
            {
                CharacterGroupList.AssignGroupIds(m_project.CharacterGroupList.CharacterGroups);
            }
        }
Esempio n. 6
0
        public void RemoveVoiceActor_ActorAssignedToMoreThanOneGroup_RemovesAllAssignmentsForSpecifiedActorOnly()
        {
            // Note: this tests something that is actually illegal: there should only ever be one group assigned
            // to a particular actor.
            var list   = new CharacterGroupList();
            var group1 = new CharacterGroup(m_project);
            var group2 = new CharacterGroup(m_project);
            var group3 = new CharacterGroup(m_project);

            group1.AssignVoiceActor(1);
            list.CharacterGroups.Add(group1);
            group2.AssignVoiceActor(1);
            list.CharacterGroups.Add(group2);
            group3.AssignVoiceActor(2);
            list.CharacterGroups.Add(group3);

            list.RemoveVoiceActor(1);

            Assert.IsFalse(list.HasVoiceActorAssigned(1));
            Assert.IsTrue(list.HasVoiceActorAssigned(2));
        }