public void CmPictureConstructor_FromTextRep() { ICmPicture pictNew = m_pictureFactory.Create(m_pict.TextRepresentation, CmFolderTags.LocalPictures); Assert.AreNotEqual(pictNew, m_pict); string internalPathNew = pictNew.PictureFileRA.InternalPath; Assert.AreEqual(m_internalPath, internalPathNew); Assert.AreEqual(internalPathNew, pictNew.PictureFileRA.AbsoluteInternalPath, "Files outside LangProject.LinkedFilesRootDir are stored as absolute paths"); AssertEx.AreTsStringsEqual(m_pict.Caption.VernacularDefaultWritingSystem, pictNew.Caption.VernacularDefaultWritingSystem); Assert.AreEqual(m_pict.PictureFileRA.Owner, pictNew.PictureFileRA.Owner); Assert.IsNull(pictNew.Description.AnalysisDefaultWritingSystem.Text); // REVIEW (TE-7745): What should the default PictureLayoutPosition value be? Assert.AreEqual(PictureLayoutPosition.CenterInColumn, pictNew.LayoutPos); Assert.AreEqual(100, pictNew.ScaleFactor); Assert.AreEqual(PictureLocationRangeType.AfterAnchor, pictNew.LocationRangeType); Assert.AreEqual(0, pictNew.LocationMin); Assert.AreEqual(0, pictNew.LocationMax); Assert.IsNull(pictNew.PictureFileRA.Copyright.VernacularDefaultWritingSystem.Text); }
/// ------------------------------------------------------------------------------------- /// <summary> /// Create a CmPicture from a dummy file. /// </summary> /// ------------------------------------------------------------------------------------- protected override void CreateTestData() { base.CreateTestData(); m_fileOs = new MockFileOS(); FileUtils.Manager.SetFileAdapter(m_fileOs); m_fileOs.AddFile(m_internalPath, "123", Encoding.Default); m_pictureFactory = Cache.ServiceLocator.GetInstance<ICmPictureFactory>(); m_pict = m_pictureFactory.Create(m_internalPath, Cache.TsStrFactory.MakeString("Test picture", Cache.DefaultVernWs), CmFolderTags.LocalPictures); Assert.IsNotNull(m_pict); Assert.AreEqual("Test picture", m_pict.Caption.VernacularDefaultWritingSystem.Text); Assert.AreEqual(m_internalPath, m_pict.PictureFileRA.InternalPath, "Internal path not set correctly"); Assert.AreEqual(m_internalPath, m_pict.PictureFileRA.AbsoluteInternalPath, "Files outside LangProject.LinkedFilesRootDir are stored as absolute paths"); }
/// ------------------------------------------------------------------------------------- /// <summary> /// Create a CmPicture from a dummy file. /// </summary> /// ------------------------------------------------------------------------------------- protected override void CreateTestData() { base.CreateTestData(); m_fileOs = new MockFileOS(); FileUtils.Manager.SetFileAdapter(m_fileOs); m_fileOs.AddFile(m_internalPath, "123", Encoding.Default); m_pictureFactory = Cache.ServiceLocator.GetInstance <ICmPictureFactory>(); m_pict = m_pictureFactory.Create(m_internalPath, Cache.TsStrFactory.MakeString("Test picture", Cache.DefaultVernWs), CmFolderTags.LocalPictures); Assert.IsNotNull(m_pict); Assert.AreEqual("Test picture", m_pict.Caption.VernacularDefaultWritingSystem.Text); Assert.AreEqual(m_internalPath, m_pict.PictureFileRA.InternalPath, "Internal path not set correctly"); Assert.AreEqual(m_internalPath, m_pict.PictureFileRA.AbsoluteInternalPath, "Files outside LangProject.LinkedFilesRootDir are stored as absolute paths"); }