Repository: nagisc007/storybuilder

Issue:
Check: character count when combined
combine した時にちゃんと行と文字数がカウントできているか
===

**Description**
combine時の確認。
間違っていたら修正。


Discussion:

Patch:
diff --git a/builder/buildtool.py b/builder/buildtool.py
index 5c005fe..08449e3 100644
--- a/builder/buildtool.py
+++ b/builder/buildtool.py
@@ -271,7 +271,7 @@ def _manupaper_rows_from_(val, lang: em.LangType, columns: int) -> int:
     elif isinstance(val, act.TagAction):
         return 0
     elif isinstance(val, act.Action):
-        return utl.int_ceiled(_descs_count_from_(val, lang), columns)
+        return _descs_count_from_(val, lang)
     else:
         return 0
 
@@ -279,7 +279,10 @@ def _manupaper_rows_from_(val, lang: em.LangType, columns: int) -> int:
 def _manupaper_rows_from_in(vals: [act.ActionGroup, list, tuple],
         lang: em.LangType, columns: int) -> int:
     group = vals.actions if isinstance(vals, act.ActionGroup) else vals
-    return sum([_manupaper_rows_from_(v, lang, columns) for v in group])
+    if isinstance(vals, act.ActionGroup) and vals.group_type is em.GroupType.COMBI:
+        return utl.int_ceiled(sum(_manupaper_rows_from_(v, lang, columns) for v in group), columns)
+    else:
+        return sum([utl.int_ceiled(_manupaper_rows_from_(v, lang, columns), columns) for v in group])
 
 
 def _maintitle_from(story: list) -> list:


Test patch:
diff --git a/tests/test_buildtool.py b/tests/test_buildtool.py
index c794c9b..b873256 100644
--- a/tests/test_buildtool.py
+++ b/tests/test_buildtool.py
@@ -157,6 +157,25 @@ class PrivateMethodsTest(unittest.TestCase):
             with self.subTest(v=v, lang=lang, expected=expected):
                 self.assertEqual(btl._estimated_description_count_from(v, lang), expected)
 
+    def test_manupaper_rows_from_in(self):
+        from builder import world
+        w = world.World("test")
+        data = [
+                ((self.taro.be().d("test"), self.taro.be().d("apple"),),
+                    em.LangType.JPN, 20, 2),
+                ((w.combine(
+                    self.taro.be().d("test"), self.taro.be().d("apple"),
+                    ),),
+                    em.LangType.JPN, 20, 1),
+                (w.combine(
+                    self.taro.be().d("test apple"), self.taro.be().d("test orange"),
+                    ),
+                    em.LangType.JPN, 20, 2),
+                ]
+        for v, lang, columns, expected in data:
+            with self.subTest(v=v, lang=lang, columns=columns, expected=expected):
+                self.assertEqual(btl._manupaper_rows_from_in(v, lang, columns), expected)
+
     def test_output_to_console(self):
         data = [
                 (["test"], False,