Hanjp-IM / libhanjp

The libarary for Hanjp engines.
GNU Lesser General Public License v2.1
6 stars 7 forks source link

Bug Report #42

Closed claycat closed 2 years ago

claycat commented 2 years ago

I found some bugs while working around with the current version of libhanjp

1. Letters containing the jamo PHIEUPH are unable to be converted into Japanese.

I wrote a simple test code with reference to test_input_context_convert.cpp

    const char *strGivenKeyInput = "qkqlqnqh.";
    const char *strExpectJapanese = "ばびぶぼ.";

which gave me the following failure

Expected equality of these values: strActualJapanese Which is: "\xE3\x81\x89." As Text: "ぉ." strExpectJapanese Which is: "\xE3\x81\xB0\xE3\x81\xB3\xE3\x81\xB6\xE3\x81\xBC." As Text: "ばびぶぼ." [ FAILED ] InputContextTest.IC_PIEUP (0 ms)

Initially, I thought this problem was due to a mistake in declaration since other jamos are working fine. I checked the basic declaration files such as hanjpunicode.h and keyboard.xml but there didn't seem to be any errors there.

2. The conversion from 'wa' (와) to ’わ’ fails to convert under some cases

    const char *strGivenKeyInput = "zydndhkzhzn.";
    const char *strExpectJapanese = "きょうわこく.";

with the following failure

Expected equality of these values: strActualJapanese Which is: "\xE3\x81\x8D\xE3\x82\x88\xE3\x81\x86\xE3\x81\x8B\xE3\x81\x93\xE3\x81\x85.\xE3\x85\x97" As Text: "きようかこぅ.ㅗ" strExpectJapanese Which is: "\xE3\x81\x8D\xE3\x82\x87\xE3\x81\x86\xE3\x82\x8F\xE3\x81\x93\xE3\x81\x8F." As Text: "きょうわこく." [ FAILED ] InputContextTest.IC_KYOUWAKOKU (0 ms)

3. Pressing shift

Pressing shift to insert double consonants, such as ㅃ

Expected behavior

no input on screen

Current behavior

shows £ sign (for left shift) or ¬ (for right shift)

4. Newline

Pressing enter to insert newline

Expected behavior

no input on screen. go to next line

Current behavior

shows only '-' sign.

Pressing shift+enter works, but always with an unnecessary £(from #3)


I read the new issue onting/ibus-hanjp/#52 regarding the engine bug, but am still unsure how this bug is related to the bugs mentioned above.

onting commented 2 years ago

Good, I'll check it out.

onting commented 2 years ago

Ah, you meant PIEUP in trouble '1'. Your report is understandable enough, though it's better to check our character representation with Hangul Unicode Table. Anyway, '1' should be fixed with my upcoming patch.

onting commented 2 years ago

Can you push your test cases into 'test' branch in this repo? @catensia It would boost my work.

onting commented 2 years ago

If you are using VS Code, setting .vscode/launch.json as below would help libhanjp debug.

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "g++ - Build and debug active file",
            "type": "cppdbg",
            "request": "launch",
            "program": "${cwd}/build/test/test_input_context_convert",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${fileDirname}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
                    "description": "Enable pretty-printing for gdb",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}
onting commented 2 years ago

Closing with above

claycat commented 2 years ago

Sorry for the late response. I went through the fixes, and it seems to be working well. I'll try to write some more test suites regarding other potential problems mentioned in the issue.