Esempio n. 1
0
        public void ColumnsNotLanguagesNotCounted()
        {
            var sheet  = new InternalSpreadsheet();
            var offset = sheet.StandardLeadingColumns.Length;

            Assert.That(sheet.ColumnForLang("en"), Is.EqualTo(offset));
            Assert.That(sheet.ColumnForLang("es"), Is.EqualTo(offset + 1));
            Assert.That(sheet.Languages, Has.Count.EqualTo(2));
            Assert.That(sheet.Languages, Has.Member("en"));
            Assert.That(sheet.Languages, Has.Member("es"));
        }
Esempio n. 2
0
        public void OneTimeSetUp()
        {
            // Cases we want to test:
            // - page has too many translation groups
            //		- V1: warn, leave extras unmodified
            //		- eventual: ?
            // - page has too few translation groups (special case: none)
            //		- V1: warn, drop extra inputs
            //		- V2: insert extra copies of page (and something else if it has no TGs)
            //		- eventual: insert extra pages using template specified in sheet
            // - there are input lines for pages that don't exist (pathological, in the middle; likely, after last; test both)
            //		- V1: warn, ignore
            //		- eventual: insert extra pages using template specified in sheet
            // - there are pages that have no input lines (but later pages do)
            // - there are pages after the last input line
            //		- V1: warn, leave unchanged.
            //		- eventual: ?
            // In this test suite, the blocks on the last page and the pages run out before
            // we run out of lines. So we can't test the case of running out of lines first.
            // Another class tests that.
            _dom   = new HtmlDom(inputBook, true);
            _sheet = new InternalSpreadsheet();
            _sheet.ColumnForLang("en");
            _sheet.ColumnForLang("fr");
            _sheet.AddRow(MakeRow("1", "New message about tigers", "New message about French tigers"));
            // problem 1: input DOM has a second TG on page 1; sheet does not.
            _sheet.AddRow(MakeRow("2", "More about tigers", "More about French tigers"));
            // problem 2: input DOM has no second TG on page 2.
            _sheet.AddRow(MakeRow("2", "Still more about tigers", "Still more about French tigers"));
            _sheet.AddRow(MakeRow("2", "More and more about tigers", "More and more about French tigers"));
            // problem 3: input DOM has no page 3 at all.
            _sheet.AddRow(MakeRow("3", "Lost story about tigers", "Lost story about French tigers"));
            _sheet.AddRow(MakeRow("3", "Another lost story about tigers", "Another lost story about French tigers"));
            // problem 4: input DOM has no page 4 at all.
            _sheet.AddRow(MakeRow("4", "Yet another lost story about tigers", "Yet another lost story about French tigers"));
            _sheet.AddRow(MakeRow("5", "A good story about tigers", "A good story about French tigers"));
            _sheet.AddRow(MakeRow("5", "Another good story about tigers", "Another good story about French tigers"));
            // problem 5: an extra block on page 5
            _sheet.AddRow(MakeRow("5", "Page 5 lost story about tigers", "Page 5 lost story about French tigers"));
            // problem 6: an extra block on after the last page
            _sheet.AddRow(MakeRow("6", "Page 6 lost story about tigers", "Page 6 lost story about French tigers"));
            var importer = new SpreadsheetImporter(this._dom, _sheet);

            _messages = importer.Import();
        }
Esempio n. 3
0
        public void OneTimeSetUp()
        {
            _dom = new HtmlDom(SpreadsheetTests.kSimpleTwoPageBook, true);
            AssertThatXmlIn.Dom(_dom.RawDom).HasSpecifiedNumberOfMatchesForXpath("//div[@lang='en']/p[text()='Riding on elephants can be risky.']", 1);             // unchanged

            var exporter = new SpreadsheetExporter();

            _sheet = exporter.Export(_dom);
            var indexDe = _sheet.ColumnForLang("de");

            _sheet.Header.SetCell(indexDe, "[tpi]");
            _sheet.ContentRows.First().SetCell(_sheet.ColumnForLang("en"), "<p>This elephant is running amok.</p>");
            _sheet.ContentRows.Skip(2).First().SetCell(_sheet.ColumnForLang("fr"), "<p>Riding on French elephants can be very risky.</p>");
            var importer = new SpreadsheetImporter(this._dom, _sheet);

            InitializeImporter(importer);
            importer.Import();
        }
Esempio n. 4
0
        public void OneTimeSetUp()
        {
            // Cases we want to test:
            // - there are more blocks on the last page after we run out of input lines
            // - there are pages after the last input line
            //		- V1: warn, leave unchanged.
            //		- eventual: ?
            // In this test suite, lines run out before the blocks.
            _dom   = new HtmlDom(inputBook, true);
            _sheet = new InternalSpreadsheet();
            _sheet.ColumnForLang("en");
            _sheet.ColumnForLang("fr");
            _sheet.AddRow(SpreadsheetImportSyncWarnings.MakeRow("1", "New message about tigers", "New message about French tigers"));
            _sheet.AddRow(SpreadsheetImportSyncWarnings.MakeRow("2", "More about tigers", "More about French tigers"));
            // problem: there's no input corresponding to the second block on page 2, nor any of page 4.
            var importer = new SpreadsheetImporter(this._dom, _sheet);

            _messages = importer.Import();
        }