public void MakeBloomPack_AddslockFormattingMetaTagToReader()
{
var srcBookPath = MakeBook();
// the html file needs to have the same name as its directory
var testFileName = Path.GetFileName(srcBookPath) + ".htm";
var readerName = Path.Combine(srcBookPath, testFileName);
var bloomPackName = Path.Combine(_folder.Path, "testReaderPack.BloomPack");
var sb = new StringBuilder();
sb.AppendLine("<!DOCTYPE html>");
sb.AppendLine("<html>");
sb.AppendLine("<head>");
sb.AppendLine(" <meta charset=\"UTF-8\"></meta>");
sb.AppendLine(" <meta name=\"Generator\" content=\"Bloom Version 3.3.0 (apparent build date: 28-Jul-2015)\"></meta>");
sb.AppendLine(" <meta name=\"BloomFormatVersion\" content=\"2.0\"></meta>");
sb.AppendLine(" <meta name=\"pageTemplateSource\" content=\"Leveled Reader\"></meta>");
sb.AppendLine(" <title>Leveled Reader</title>");
sb.AppendLine(" <link rel=\"stylesheet\" href=\"basePage.css\" type=\"text/css\"></link>");
sb.AppendLine("</head>");
sb.AppendLine("<body>");
sb.AppendLine("</body>");
sb.AppendLine("</html>");
File.WriteAllText(readerName, sb.ToString());
// make the BloomPack
MakeTestBloomPack(bloomPackName, true);
// get the reader file from the BloomPack
var actualFiles = GetActualFilenamesFromZipfile(bloomPackName);
var zipEntryName = actualFiles.FirstOrDefault(file => file.EndsWith(testFileName));
Assert.That(zipEntryName, Is.Not.Null.And.Not.Empty);
string outputText;
using (var zip = new ZipFile(bloomPackName))
{
var ze = zip.GetEntry(zipEntryName);
var buffer = new byte[4096];
using (var instream = zip.GetInputStream(ze))
using (var writer = new MemoryStream())
{
ICSharpCode.SharpZipLib.Core.StreamUtils.Copy(instream, writer, buffer);
writer.Position = 0;
using (var reader = new StreamReader(writer))
{
outputText = reader.ReadToEnd();
}
}
}
// check for the lockFormatting meta tag
Assert.That(outputText, Is.Not.Null.And.Not.Empty);
Assert.IsTrue(outputText.Contains("<meta name=\"lockFormatting\" content=\"true\">"));
}