Skip to content

Commit

Permalink
Add test case for case-sensitive character-glyphs names. #156
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiocaccamo committed Dec 8, 2023
1 parent a4529a4 commit a04ac5f
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
55 changes: 55 additions & 0 deletions robocjk/tests/api/test_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,61 @@ def test_0270_character_glyph_create(self):
)
self.assert_response_ok(response)

def test_0271_character_glyph_create_case_sensitive(self):
# print('test_0271_character_glyph_create_case_sensitive')

endpoint = "/api/character-glyph/create/"

# create E
payload = {
"font_uid": self.get_font_uid(),
"data": self.get_glif_data("character_glyph_create/E_.glif"),
}
response, data = self.get_response(endpoint, payload=payload)
self.assert_response_ok(response)

# create E -> already exists, expect failure
response, data = self.get_response(endpoint, payload=payload)
self.assert_response_bad_request(response)

# create e
payload = {
"font_uid": self.get_font_uid(),
"data": self.get_glif_data("character_glyph_create/e.glif"),
}
response, data = self.get_response(endpoint, payload=payload)
self.assert_response_ok(response)

# create e -> already exists, expect failure
response, data = self.get_response(endpoint, payload=payload)
self.assert_response_bad_request(response)

# delete E
payload = {
"font_uid": self.get_font_uid(),
"name": "E",
}
response, data = self.get_response(
"/api/character-glyph/lock/", payload=payload
)
response, data = self.get_response(
"/api/character-glyph/delete/", payload=payload
)
self.assert_response_ok(response)

# delete e
payload = {
"font_uid": self.get_font_uid(),
"name": "e",
}
response, data = self.get_response(
"/api/character-glyph/lock/", payload=payload
)
response, data = self.get_response(
"/api/character-glyph/delete/", payload=payload
)
self.assert_response_ok(response)

def test_0275_character_glyph_lock(self):
# print('test_0275_character_glyph_lock')
payload = {
Expand Down
22 changes: 22 additions & 0 deletions robocjk/tests/api/test_apis_data/character_glyph_create/E_.glif
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="E" format="2">
<advance width="639" />
<unicode hex="0045" />
<outline>
<contour>
<point x="33.6" y="52.0" type="line" smooth="yes" />
<point x="14.7" y="52.0" />
<point x="7.6" y="42.8" />
<point x="7.6" y="28.2" type="curve" smooth="yes" />
<point x="7.6" y="17.8" />
<point x="9.6" y="10.0" />
<point x="13.2" y="0.0" type="curve" />
</contour>
</outline>
<lib>
<dict>
<key>robocjk.status</key>
<integer>0</integer>
</dict>
</lib>
</glyph>
22 changes: 22 additions & 0 deletions robocjk/tests/api/test_apis_data/character_glyph_create/e.glif
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?>
<glyph name="e" format="2">
<advance width="639" />
<unicode hex="0065" />
<outline>
<contour>
<point x="33.6" y="52.0" type="line" smooth="yes" />
<point x="14.7" y="52.0" />
<point x="7.6" y="42.8" />
<point x="7.6" y="28.2" type="curve" smooth="yes" />
<point x="7.6" y="17.8" />
<point x="9.6" y="10.0" />
<point x="13.2" y="0.0" type="curve" />
</contour>
</outline>
<lib>
<dict>
<key>robocjk.status</key>
<integer>0</integer>
</dict>
</lib>
</glyph>

0 comments on commit a04ac5f

Please sign in to comment.