Skip to content

Commit

Permalink
实现了Passage标题及元数据读取
Browse files Browse the repository at this point in the history
  • Loading branch information
ModerRAS committed Aug 9, 2023
1 parent 0c4ff56 commit a64b586
Show file tree
Hide file tree
Showing 12 changed files with 472 additions and 9 deletions.
13 changes: 13 additions & 0 deletions BannerlordTwee.Test/BannerlordTwee.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,17 @@
<Folder Include="TestFiles\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BannerlordTwee\BannerlordTwee.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="TestFiles\1.twee">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TestFiles\2.twee">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
36 changes: 36 additions & 0 deletions BannerlordTwee.Test/ParseTitleTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using BannerlordTwee.Parser;

namespace BannerlordTwee.Test {
[TestClass]
public class ParseTitleTest {
[TestMethod]
public void TestStoryTitle() {
var parser = new TweeParser("");
var title = parser.ParseTitle(":: StoryTitle");
Assert.AreEqual(title.Name, "StoryTitle");
Assert.AreEqual(title.OtherIsEmpty, true);
Assert.AreEqual(title.IsStoryTitle, true);
Assert.AreEqual(title.IsStoryData, false);
}
[TestMethod]
public void TestStoryData() {
var parser = new TweeParser("");
var title = parser.ParseTitle(":: StoryData");
Assert.AreEqual(title.Name, "StoryData");
Assert.AreEqual(title.OtherIsEmpty, true);
Assert.AreEqual(title.IsStoryTitle, false);
Assert.AreEqual(title.IsStoryData, true);
}
[TestMethod]
public void TestNormal_1() {
var parser = new TweeParser("");
var title = parser.ParseTitle(":: ÏÂÒ»Ïî {\"position\":\"900,625\",\"size\":\"100,100\"}");
Assert.AreEqual(title.Name, "ÏÂÒ»Ïî");
Assert.AreEqual(title.OtherIsEmpty, false);
Assert.AreEqual(title.IsStoryTitle, false);
Assert.AreEqual(title.IsStoryData, false);
Assert.AreEqual(title.Size, "100,100");
Assert.AreEqual(title.Tags, null)

Check failure on line 33 in BannerlordTwee.Test/ParseTitleTest.cs

View workflow job for this annotation

GitHub Actions / build

; expected

Check failure on line 33 in BannerlordTwee.Test/ParseTitleTest.cs

View workflow job for this annotation

GitHub Actions / build

; expected
}
}
}
56 changes: 56 additions & 0 deletions BannerlordTwee.Test/TestFiles/2.twee
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:: StoryTitle
1


:: StoryData
{
"ifid": "6B2EFB77-3101-4602-B826-06BBFDD3D345",
"format": "Harlowe",
"format-version": "3.3.6",
"start": "开始",
"tag-colors": {
"tag2": "red",
"taga": "orange"
},
"zoom": 1
}


:: 下一项 {"position":"900,625","size":"100,100"}
这里是下一项


:: 下一项2 {"position":"1050,575","size":"100,100"}
这里是下一项2


:: 开始 {"position":"700,325","size":"100,100"}
啊啊啊

<!--Comment Text-->

[[选项1->这是选项1]]
[[选项2->这是选项2]]
[[选项3]]

\::


:: 这是选项1 [tag1 tag2 taga] {"position":"950,125","size":"100,100"}
不是很好

[[选项3]]
[[这是选项2]]
[[返回->开始]]



:: 这是选项2 {"position":"875,475","size":"100,100"}
这里是选项2

[[下一项]]
[[第二个->下一项2]]


:: 选项3 [tagme] {"position":"1050,325","size":"100,100"}
这里是选项3
56 changes: 56 additions & 0 deletions BannerlordTwee.Test/TestFiles/3.twee
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:: StoryTitle
1


:: StoryData
{
"ifid": "6B2EFB77-3101-4602-B826-06BBFDD3D345",
"format": "Harlowe",
"format-version": "3.3.6",
"start": "开始",
"tag-colors": {
"tag2": "red",
"taga": "orange"
},
"zoom": 1
}


:: StoryData {"position":"1050,575","size":"100,100"}
这里是下一项2


:: StoryTitle {"position":"900,625","size":"100,100"}
这里是下一项


:: 开始 {"position":"700,325","size":"100,100"}
啊啊啊

<!--Comment Text-->

[[选项1->这是选项1]]
[[选项2->这是选项2]]
[[选项3]]

\::


:: 这是选项1 [tag1 tag2 taga] {"position":"950,125","size":"100,100"}
不是很好

[[选项3]]
[[这是选项2]]
[[返回->开始]]



:: 这是选项2 {"position":"875,475","size":"100,100"}
这里是选项2

[[StoryTitle]]
[[第二个->StoryData]]


:: 选项3 [tagme] {"position":"1050,325","size":"100,100"}
这里是选项3
56 changes: 56 additions & 0 deletions BannerlordTwee.Test/TestFiles/4.twee
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:: StoryTitle
1


:: StoryData
{
"ifid": "6B2EFB77-3101-4602-B826-06BBFDD3D345",
"format": "Harlowe",
"format-version": "3.3.6",
"start": "开始",
"tag-colors": {
"tag2": "red",
"taga": "orange"
},
"zoom": 1
}


:: StoryData {"position":"1050,575","size":"100,100"}
这里是下一项2


:: StoryTitle {"position":"900,625","size":"100,100"}
这里是下一项


:: 开始 {"position":"700,325","size":"100,100"}
啊啊啊

<!--Comment Text-->

[[选项1->这是选项1]]
[[选项2->这是选项2]]
[[选项3]]

\::


:: 这是选项1 [tag1 tag2 taga] {"position":"950,125","size":"100,100"}
不是很好

[[选项3]]
[[这是选项2]]
[[返回->开始]]



:: 这是选项2 {"position":"875,475","size":"100,100"}
这里是选项2

[[StoryTitle]]
[[第二个->StoryData]]


:: 选项3 [tagme \[a\]] {"position":"1050,325","size":"100,100"}
这里是选项3
56 changes: 56 additions & 0 deletions BannerlordTwee.Test/TestFiles/5.twee
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:: StoryTitle
1


:: StoryData
{
"ifid": "6B2EFB77-3101-4602-B826-06BBFDD3D345",
"format": "Harlowe",
"format-version": "3.3.6",
"start": "开始",
"tag-colors": {
"tag2": "red",
"taga": "orange"
},
"zoom": 1
}


:: StoryData {"position":"1050,575","size":"100,100"}
这里是下一项2


:: StoryTitle {"position":"900,625","size":"100,100"}
这里是下一项


:: 开始 {"position":"700,325","size":"100,100"}
啊啊啊

<!--Comment Text-->

[[选项1->这是选项1]]
[[选项2->这是选项2]]
[[选项3]]

\::


:: 这是选项1 [tag1 tag2 taga] {"position":"950,125","size":"100,100"}
不是很好

[[选项3]]
[[这是选项2]]
[[返回->开始]]



:: 这是选项2 {"position":"875,475","size":"100,100"}
这里是选项2

[[StoryTitle]]
[[第二个->StoryData]]


:: 选项3 [tagme \[a\] \{b\}] {"position":"1050,325","size":"100,100"}
这里是选项3
56 changes: 56 additions & 0 deletions BannerlordTwee.Test/TestFiles/6.twee
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:: StoryTitle
1


:: StoryData
{
"ifid": "6B2EFB77-3101-4602-B826-06BBFDD3D345",
"format": "Harlowe",
"format-version": "3.3.6",
"start": "开始",
"tag-colors": {
"tag2": "red",
"taga": "orange"
},
"zoom": 1
}


:: StoryData {"position":"1050,575","size":"100,100"}
这里是下一项2


:: StoryTitle {"position":"900,625","size":"100,100"}
这里是下一项


:: 开始 {"position":"700,325","size":"100,100"}
啊啊啊

<!--Comment Text-->

[[选项1->这是选项1]]
[[选项2->这是选项2]]
[[选项3]]

\::


:: 这是选项1 [tag1 tag2 taga] {"position":"950,125","size":"100,100"}
不是很好

[[选项3]]
[[这是选项2]]
[[返回->开始]]



:: 这是选项2 {"position":"875,475","size":"100,100"}
这里是选项2

[[StoryTitle]]
[[第二个->StoryData]]


:: 选项3 [tagme \[a\] \{b\} aa---a] {"position":"1050,325","size":"100,100"}
这里是选项3
56 changes: 56 additions & 0 deletions BannerlordTwee.Test/TestFiles/7.twee
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
:: StoryTitle
1


:: StoryData
{
"ifid": "6B2EFB77-3101-4602-B826-06BBFDD3D345",
"format": "Harlowe",
"format-version": "3.3.6",
"start": "开始",
"tag-colors": {
"tag2": "red",
"taga": "orange"
},
"zoom": 1
}


:: StoryData {"position":"1050,575","size":"100,100"}
这里是下一项2


:: StoryTitle {"position":"900,625","size":"100,100"}
这里是下一项


:: 开始 {"position":"700,325","size":"100,100"}
啊啊啊

<!--Comment Text-->

[[选项1->这是选项1]]
[[选项2->这是选项2]]
[[选项 3]]

\::


:: 这是选项1 [tag1 tag2 taga] {"position":"950,125","size":"100,100"}
不是很好

[[选项 3]]
[[这是选项2]]
[[返回->开始]]



:: 这是选项2 {"position":"875,475","size":"100,100"}
这里是选项2

[[StoryTitle]]
[[第二个->StoryData]]


:: 选项 3 [tagme \[a\] \{b\} aa---a] {"position":"1050,325","size":"100,100"}
这里是选项3
Loading

0 comments on commit a64b586

Please sign in to comment.