Skip to content

Commit 4de8f28

Browse files
authored
Add Arabic and Hindi
1 parent d20d040 commit 4de8f28

12 files changed

Lines changed: 486751 additions & 2 deletions

tests.py

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -991,6 +991,88 @@ def test_raise_if_invalid_orientation(self):
991991
except ValueError:
992992
pass
993993

994+
def test_generate_data_with_arabic_text(self):
995+
FakeTextDataGenerator.generate(
996+
21,
997+
"اختبار اختبار اختبار",
998+
"tests/font_ar.ttf",
999+
"tests/out/",
1000+
64,
1001+
"png",
1002+
0,
1003+
False,
1004+
0,
1005+
False,
1006+
1,
1007+
0,
1008+
0,
1009+
False,
1010+
1,
1011+
-1,
1012+
0,
1013+
"#010101",
1014+
0,
1015+
1,
1016+
0,
1017+
(5, 5, 5, 5),
1018+
0,
1019+
0,
1020+
True,
1021+
os.path.join(os.path.split(os.path.realpath(__file__))[0], "trdg/images"),
1022+
)
1023+
1024+
self.assertTrue(
1025+
diff(
1026+
"tests/out/21_اختبار اختبار اختبار.png",
1027+
"tests/expected_results/21_اختبار اختبار اختبار.png",
1028+
delete_diff_file=True,
1029+
)
1030+
< 0.01
1031+
)
1032+
1033+
os.remove("tests/out/21_اختبار اختبار اختبار.png")
1034+
1035+
def test_generate_data_with_hindi_text(self):
1036+
FakeTextDataGenerator.generate(
1037+
22,
1038+
"परीक्षा परीक्षा परीक्षा",
1039+
"tests/font_hi.ttf",
1040+
"tests/out/",
1041+
64,
1042+
"png",
1043+
0,
1044+
False,
1045+
0,
1046+
False,
1047+
1,
1048+
0,
1049+
0,
1050+
False,
1051+
1,
1052+
-1,
1053+
0,
1054+
"#010101",
1055+
0,
1056+
1,
1057+
0,
1058+
(5, 5, 5, 5),
1059+
0,
1060+
0,
1061+
True,
1062+
os.path.join(os.path.split(os.path.realpath(__file__))[0], "trdg/images"),
1063+
)
1064+
1065+
self.assertTrue(
1066+
diff(
1067+
"tests/out/22_परीक्षा परीक्षा परीक्षा.png",
1068+
"tests/expected_results/22_परीक्षा परीक्षा परीक्षा.png",
1069+
delete_diff_file=True,
1070+
)
1071+
< 0.01
1072+
)
1073+
1074+
os.remove("tests/out/22_परीक्षा परीक्षा परीक्षा.png")
1075+
9941076
def test_generate_string_with_letters(self):
9951077
s = create_strings_randomly(1, False, 1, True, False, False, "en")[0]
9961078

6.39 KB
Loading
10.6 KB
Loading

tests/font_ar.ttf

183 KB
Binary file not shown.

tests/font_hi.ttf

70.6 KB
Binary file not shown.

trdg/dicts/TEST TEST TEST_4.jpg

-2.29 KB
Binary file not shown.

0 commit comments

Comments
 (0)