protected void SetUp() { Common.Testing = true; //_styleName = new Styles(); //_util = new Utility(); _projInfo = new PublicationInformation(); _progressBar = new ProgressBar(); string testPath = PathPart.Bin(Environment.CurrentDirectory, "/OpenOfficeConvert/TestFiles"); _inputPath = Common.PathCombine(testPath, "input"); _outputPath = Common.PathCombine(testPath, "output"); _expectedPath = Common.PathCombine(testPath, "expected"); _expectedlinuxPath = Common.PathCombine(testPath, "expectedlinux"); Common.DeleteDirectory(_outputPath); Directory.CreateDirectory(_outputPath); FolderTree.Copy(FileInput("Pictures"), FileOutput("Pictures")); _projInfo.ProgressBar = _progressBar; _projInfo.OutputExtension = "odt"; _projInfo.ProjectInputType = "Dictionary"; _projInfo.IsFrontMatterEnabled = false; _projInfo.FinalOutput = "odt"; Common.SupportFolder = ""; Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFIles"); Common.ProgBase = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFiles"); // for masterDocument Common.UseAfterBeforeProcess = false; _styleFile = "styles.xml"; _contentFile = "content.xml"; _isLinux = Common.IsUnixOS(); if (!_isLinux) { LoadParam("Dictionary", "false"); } }
public void ScriptureExportTest() { string inputSourceDirectory = FileInput("ExportLO"); string outputDirectory = FileOutput("ExportLO"); if (Directory.Exists(outputDirectory)) { Directory.Delete(outputDirectory, true); } FolderTree.Copy(inputSourceDirectory, outputDirectory); Param.SetLoadType = "Scripture"; Param.LoadSettings(); _projInfo.ProjectPath = outputDirectory; _projInfo.ProjectInputType = "Scripture"; _projInfo.DefaultXhtmlFileWithPath = Common.PathCombine(outputDirectory, "ScriptureInput.xhtml"); _projInfo.DefaultCssFileWithPath = Common.PathCombine(outputDirectory, "ScriptureInput.css"); _projInfo.OutputExtension = "odt"; //EnableConfigurationSettings(outputDirectory); var target = new ExportLibreOffice(); const bool expectedResult = true; bool actual = target.Export(_projInfo); Assert.AreEqual(expectedResult, actual); }
protected void CreateDictionaryForMIDs(PublicationInformation projInfo) { var output = new DictionaryForMIDsStreamWriter(projInfo); Debug.Assert(output.Directory != null); string assemblyPath = Common.AssemblyPath; var DictionaryForMIDsPath = Path.Combine(assemblyPath, "Dic4Mid"); if (!Directory.Exists(DictionaryForMIDsPath)) { DictionaryForMIDsPath = Path.Combine(Path.GetDirectoryName(assemblyPath), "Dic4Mid"); } var creatorPath = Common.PathCombine(DictionaryForMIDsPath, "DfM-Creator"); FolderTree.Copy(creatorPath, output.Directory); const string prog = "java"; SubProcess.RedirectOutput = LogName; var args1 = string.Format(@"-jar DfM-Creator.jar -DictionaryGeneration .{0}main.txt . .", Path.DirectorySeparatorChar); SubProcess.RunCommand(output.Directory, prog, args1, true); var args2 = string.Format(@"-jar DfM-Creator.jar -JarCreator .{0}dictionary{0} .{0}Empty_Jar-Jad{0} .", Path.DirectorySeparatorChar); SubProcess.RunCommand(output.Directory, prog, args2, true); }
private void CopyFolderSupportToIO(string fileName) { string fromFileName = Common.PathCombine(_supportSource, fileName); string toFileName = Common.PathCombine(_inputBasePath, fileName); FolderTree.Copy(fromFileName, toFileName); toFileName = Common.PathCombine(_outputBasePath, fileName); FolderTree.Copy(fromFileName, toFileName); }
public void MoveJarFileTest() { Common.Testing = true; PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Copy("sena3-imba.xhtml"); FolderTree.Copy(_testFiles.Input("DfM_enseh_SIL"), _testFiles.Output("DfM_enseh_SIL")); MoveJarFile(projInfo); Assert.True(File.Exists(_testFiles.Output("DfM_enseh_SIL.jar"))); }
public void CreateSubmissionTest() { Common.Testing = true; PublicationInformation projInfo = new PublicationInformation(); projInfo.DefaultXhtmlFileWithPath = _testFiles.Copy("sena3-imba.xhtml"); FolderTree.Copy(_testFiles.Input("DfM_enseh_SIL"), _testFiles.Output("DfM_enseh_SIL")); CreateSubmission(projInfo); var dirInfo = new DirectoryInfo(_testFiles.Output("")); Assert.AreEqual(1, dirInfo.GetFiles("DictionaryForMIDs_*_enseh_SIL.zip").Length); }
private void ReportWithSword(string swordOutputExportLocation, string xhtmlLang, string swordData) { if (!Common.Testing && swordOutputExportLocation != null && Directory.Exists(swordOutputExportLocation) && xhtmlLang != null) { var msg = LocalizationManager.GetString("ExportSword.ResultClick.Message", "Sword output successfully created. Select Yes to install the results (replacing previous results for the same language), no to open the folder {0} and Cancel for neither?", ""); msg = string.Format(msg, swordOutputExportLocation); var result = MessageBox.Show(msg, "Results", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { var confName = Path.Combine("mods.d", xhtmlLang + ".conf"); const bool overwrite = true; File.Copy(Path.Combine(swordOutputExportLocation, confName), Path.Combine(swordData, confName), overwrite); var dataLoc = Path.Combine(Path.Combine(Path.Combine("modules", "texts"), "ztext"), xhtmlLang); var instData = Path.Combine(swordData, dataLoc); if (Directory.Exists(instData)) { Directory.Delete(instData, true); } FolderTree.Copy(Path.Combine(swordOutputExportLocation, dataLoc), instData); try { if (Common.IsUnixOS()) { Process.Start("/usr/bin/xiphos"); } else { var cmd = RegistryHelperLite.SwordKeyCommandValue; Process.Start(cmd.Substring(1, cmd.Length - 7)); } } catch { // ignored } } else if (result == DialogResult.No) { DisplayOutput(swordOutputExportLocation); } } }
protected string CreateHtml5(PublicationInformation projInfo, InProcess inProcess, string epub3Path) { inProcess.SetStatus("Copy html files"); string htmlFolderPath = Common.PathCombine(Path.GetDirectoryName(epub3Path), "HTML5"); string oebpsFolderPath = Common.PathCombine(epub3Path, "OEBPS"); var bootstrapToc = Common.PathCombine(epub3Path, "bootstrapToc.html"); File.Copy(Path.Combine(oebpsFolderPath, "toc.ncx"), bootstrapToc); Common.ApplyXslt(bootstrapToc, _toc2Html5); Common.CustomizedFileCopy(inProcess, oebpsFolderPath, htmlFolderPath, "content.opf,toc.xhtml,toc.ncx,File3TOC00000_.html,File2TOC00000_.html,File1TOC00000_.html,File0TOC00000_.html"); var avFolder = Path.Combine(projInfo.ProjectPath, "AudioVisual"); if (Directory.Exists(avFolder)) { FolderTree.Copy(avFolder, Path.Combine(htmlFolderPath, "pages", "AudioVisual")); } File.Delete(bootstrapToc); return(htmlFolderPath); }
public void ExportDictionaryTest() { string inputSourceDirectory = FileInput(""); string outputDirectory = FileOutput(""); if (Directory.Exists(outputDirectory)) { Directory.Delete(outputDirectory, true); } FolderTree.Copy(inputSourceDirectory, outputDirectory); Param.SetLoadType = "Dictionary"; Param.LoadSettings(); _projInfo.ProjectPath = outputDirectory; _projInfo.ProjectInputType = "Dictionary"; _projInfo.DefaultXhtmlFileWithPath = Common.PathCombine(outputDirectory, "ExportDictionarymain.xhtml"); _projInfo.DefaultCssFileWithPath = Common.PathCombine(outputDirectory, "ExportDictionarymain.css"); var target = new ExportPdf(); const bool expectedResult = true; bool actual = target.Export(_projInfo); Assert.AreEqual(expectedResult, actual); }
public void CleanUpTest() { Common.Testing = true; const string createFolder = "CreateDictionaryForMIDs"; var outDir = _testFiles.Output(createFolder); if (Directory.Exists(outDir)) { Directory.Delete(outDir, true); } var inDir = _testFiles.Input(createFolder); FolderTree.Copy(inDir, outDir); CleanUp(Common.PathCombine(outDir, "main.xhtml")); Assert.True(Directory.Exists(Common.PathCombine(outDir, "DfM_lojen_SIL"))); Assert.False(Directory.Exists(Common.PathCombine(outDir, "dictionary"))); Assert.False(Directory.Exists(Common.PathCombine(outDir, "Empty_Jar-Jad"))); Assert.True(File.Exists(Common.PathCombine(outDir, "Convert.log"))); Assert.True(File.Exists(Common.PathCombine(outDir, "DfM copyright notice.txt"))); Assert.True(File.Exists(Common.PathCombine(outDir, "DictionaryForMIDs.properties"))); Assert.True(File.Exists(Common.PathCombine(outDir, "main.txt"))); Assert.False(File.Exists(Common.PathCombine(outDir, "DfM-Creator.jar"))); Assert.False(File.Exists(Common.PathCombine(outDir, "go.bat"))); }