Add new features to new project title page
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
Jane Doe
|
||||
Address 1
|
||||
Address 2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Test Project A
|
||||
|
||||
**By Jane Doe**
|
||||
|
||||
Word Count: 11
|
||||
|
||||
## Chapter 1
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
## Chapter 2
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
## Chapter 3
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
Jane Doe
|
||||
Address 1
|
||||
Address 2
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Test Project B
|
||||
|
||||
**By Jane Doe**
|
||||
|
||||
Word Count: 11
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
* * *
|
||||
|
||||
@@ -31,10 +31,13 @@ import pytest
|
||||
|
||||
from novelwriter import CONFIG
|
||||
from novelwriter.constants import nwConst, nwFiles, nwItemClass
|
||||
from novelwriter.core.buildsettings import BuildSettings
|
||||
from novelwriter.core.coretools import (
|
||||
DocDuplicator, DocMerger, DocSearch, DocSplitter, ProjectBuilder
|
||||
)
|
||||
from novelwriter.core.docbuild import NWBuildDocument
|
||||
from novelwriter.core.project import NWProject
|
||||
from novelwriter.enum import nwBuildFmt
|
||||
|
||||
from tests.mocked import causeOSError
|
||||
from tests.tools import NWD_IGNORE, XML_IGNORE, C, buildTestProject, cmpFiles
|
||||
@@ -507,10 +510,6 @@ def testCoreTools_ProjectBuilderA(monkeypatch, fncPath, tstPaths, mockGUI, mockR
|
||||
"""Create a new project from a project dictionary, with chapters."""
|
||||
monkeypatch.setattr("uuid.uuid4", lambda *a: uuid.UUID("d0f3fe10-c6e6-4310-8bfd-181eb4224eed"))
|
||||
|
||||
projFile = fncPath / "nwProject.nwx"
|
||||
testFile = tstPaths.outDir / "coreTools_ProjectBuilderA_nwProject.nwx"
|
||||
compFile = tstPaths.refDir / "coreTools_ProjectBuilderA_nwProject.nwx"
|
||||
|
||||
data = {
|
||||
"name": "Test Project A",
|
||||
"author": "Jane Doe",
|
||||
@@ -531,19 +530,34 @@ def testCoreTools_ProjectBuilderA(monkeypatch, fncPath, tstPaths, mockGUI, mockR
|
||||
builder = ProjectBuilder()
|
||||
assert builder.buildProject(data) is True
|
||||
|
||||
projFile = fncPath / "nwProject.nwx"
|
||||
testFile = tstPaths.outDir / "coreTools_ProjectBuilderA_nwProject.nwx"
|
||||
compFile = tstPaths.refDir / "coreTools_ProjectBuilderA_nwProject.nwx"
|
||||
|
||||
copyfile(projFile, testFile)
|
||||
assert cmpFiles(testFile, compFile, ignoreStart=XML_IGNORE)
|
||||
|
||||
# Check Content
|
||||
project = NWProject()
|
||||
project.openProject(fncPath)
|
||||
|
||||
build = BuildSettings()
|
||||
|
||||
docBuild = NWBuildDocument(project, build)
|
||||
docBuild.queueAll()
|
||||
|
||||
testFile = tstPaths.outDir / "coreTools_ProjectBuilderA_Project.md"
|
||||
compFile = tstPaths.refDir / "coreTools_ProjectBuilderA_Project.md"
|
||||
|
||||
assert list(docBuild.iterBuildDocument(testFile, nwBuildFmt.EXT_MD))
|
||||
assert cmpFiles(testFile, compFile, ignoreStart=XML_IGNORE)
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_ProjectBuilderB(monkeypatch, fncPath, tstPaths, mockGUI, mockRnd):
|
||||
"""Create a new project from a project dictionary, without chapters."""
|
||||
monkeypatch.setattr("uuid.uuid4", lambda *a: uuid.UUID("d0f3fe10-c6e6-4310-8bfd-181eb4224eed"))
|
||||
|
||||
projFile = fncPath / "nwProject.nwx"
|
||||
testFile = tstPaths.outDir / "coreTools_ProjectBuilderB_nwProject.nwx"
|
||||
compFile = tstPaths.refDir / "coreTools_ProjectBuilderB_nwProject.nwx"
|
||||
|
||||
data = {
|
||||
"name": "Test Project B",
|
||||
"author": "Jane Doe",
|
||||
@@ -564,9 +578,28 @@ def testCoreTools_ProjectBuilderB(monkeypatch, fncPath, tstPaths, mockGUI, mockR
|
||||
builder = ProjectBuilder()
|
||||
assert builder.buildProject(data) is True
|
||||
|
||||
projFile = fncPath / "nwProject.nwx"
|
||||
testFile = tstPaths.outDir / "coreTools_ProjectBuilderB_nwProject.nwx"
|
||||
compFile = tstPaths.refDir / "coreTools_ProjectBuilderB_nwProject.nwx"
|
||||
|
||||
copyfile(projFile, testFile)
|
||||
assert cmpFiles(testFile, compFile, ignoreStart=XML_IGNORE)
|
||||
|
||||
# Check Content
|
||||
project = NWProject()
|
||||
project.openProject(fncPath)
|
||||
|
||||
build = BuildSettings()
|
||||
|
||||
docBuild = NWBuildDocument(project, build)
|
||||
docBuild.queueAll()
|
||||
|
||||
testFile = tstPaths.outDir / "coreTools_ProjectBuilderB_Project.md"
|
||||
compFile = tstPaths.refDir / "coreTools_ProjectBuilderB_Project.md"
|
||||
|
||||
assert list(docBuild.iterBuildDocument(testFile, nwBuildFmt.EXT_MD))
|
||||
assert cmpFiles(testFile, compFile, ignoreStart=XML_IGNORE)
|
||||
|
||||
|
||||
@pytest.mark.core
|
||||
def testCoreTools_ProjectBuilderCopyPlain(monkeypatch, caplog, mockGUI, prjLipsum, fncPath):
|
||||
|
||||
Reference in New Issue
Block a user