t-suw****@users*****
t-suw****@users*****
2007年 10月 14日 (日) 18:07:10 JST
Index: AquaSKK/src/test/.cvsignore
diff -u AquaSKK/src/test/.cvsignore:1.1.2.2 AquaSKK/src/test/.cvsignore:1.1.2.3
--- AquaSKK/src/test/.cvsignore:1.1.2.2 Mon Sep 24 19:04:34 2007
+++ AquaSKK/src/test/.cvsignore Sun Oct 14 18:07:09 2007
@@ -1,6 +1,7 @@
.depend
.gdb_history
KotoeriDictionary_TEST
+SKKBackEnd_TEST
SKKEditBuffer_TEST
SKKInputBuffer_TEST
SKKKeymapEntry_TEST
Index: AquaSKK/src/test/Makefile
diff -u AquaSKK/src/test/Makefile:1.1.2.7 AquaSKK/src/test/Makefile:1.1.2.8
--- AquaSKK/src/test/Makefile:1.1.2.7 Mon Sep 24 19:04:34 2007
+++ AquaSKK/src/test/Makefile Sun Oct 14 18:07:09 2007
@@ -9,11 +9,13 @@
PROGS = $(SRCS:.cpp=)
DEPDIR = .depend
LIB = libtest.a
-LDFLAGS = -L. -ltest -framework Carbon
+LDFLAGS = -L. -ltest -framework Carbon -framework CoreFoundation
LIBOBJS = SKKKeymapEntry.o SKKKeymap.o SKKRuleTreeNode.o SKKRomanKanaConverter.o \
SKKInputBuffer.o jconv.o SKKEditBuffer.o KotoeriDictionary.o CppCFString.o \
- SKKDictionary.o SKKConfig.o CppCFData.o
+ SKKDictionary.o SKKConfig.o CppCFData.o SKKBackEnd.o NumericConverter.o \
+ ServerConnection.o ServerConnectionFactory.o ClientConfiguration.o \
+ CppMessagePortConnection.o
all: $(LIB) $(PROGS)
Index: AquaSKK/src/test/SKKBackEnd_TEST.cpp
diff -u /dev/null AquaSKK/src/test/SKKBackEnd_TEST.cpp:1.1.2.1
--- /dev/null Sun Oct 14 18:07:10 2007
+++ AquaSKK/src/test/SKKBackEnd_TEST.cpp Sun Oct 14 18:07:09 2007
@@ -0,0 +1,31 @@
+#include <iostream>
+#include <sstream>
+#include "SKKBackEnd.h"
+
+int main() {
+ std::vector<std::string> comp;
+ SKK::CandidateContainer tmp;
+
+ SKKBackEnd::RegisterOkuriAri("ãããããã¦ãt", "ã¨", SKK::Candidate("éããããã¹ã"));
+ SKKBackEnd::FindOkuriAri("ãããããã¦ãt", "ã¨", tmp);
+ assert(!tmp.empty() && tmp[0].Face() == "éããããã¹ã");
+
+ SKKBackEnd::RemoveOkuriAri("ãããããã¦ãt", SKK::Candidate("éããããã¹ã"));
+ assert(!SKKBackEnd::FindOkuriAri("ãããããã¦ãt", "ã¨", tmp));
+
+ SKKBackEnd::RegisterOkuriNasi("SKKBackEnd_TEST", SKK::Candidate("åè£"));
+
+ SKKBackEnd::FindOkuriNasi("SKKBackEnd_TEST", tmp);
+ assert(!tmp.empty() && tmp[0].Face() == "åè£");
+
+ SKKBackEnd::Complete("SKKBackEnd", comp);
+ assert(!comp.empty() && comp[0] == "SKKBackEnd_TEST");
+
+ SKKBackEnd::RemoveOkuriNasi("SKKBackEnd_TEST", SKK::Candidate("åè£"));
+ SKKBackEnd::FindOkuriNasi("SKKBackEnd_TEST", tmp);
+ assert(tmp.empty());
+
+ SKKBackEnd::RegisterToggleEntry("ãããããããã¶ãã¼ã·ãã¼ã¤ãã¼ã¦ã");
+ SKKBackEnd::Complete("ãããããããã¶ãã¼ã·ãã¼ã¤ãã¼ã¦", comp);
+ assert(!comp.empty() && comp[0] == "ãããããããã¶ãã¼ã·ãã¼ã¤ãã¼ã¦ã");
+}
Index: AquaSKK/src/test/SKKKeymapEntry_TEST.cpp
diff -u AquaSKK/src/test/SKKKeymapEntry_TEST.cpp:1.1.2.2 AquaSKK/src/test/SKKKeymapEntry_TEST.cpp:1.1.2.3
--- AquaSKK/src/test/SKKKeymapEntry_TEST.cpp:1.1.2.2 Tue Sep 11 23:08:20 2007
+++ AquaSKK/src/test/SKKKeymapEntry_TEST.cpp Sun Oct 14 18:07:09 2007
@@ -12,33 +12,33 @@
entry = SKKKeymapEntry("SKK_JMODE", "a");
entry >> key;
- assert(key == SKKKeyState::Ascii('a', false));
+ assert(key == SKKKeyState::CharCode('a', false));
assert(entry.Symbol() == SKK_JMODE);
assert(!(entry >> key));
entry = SKKKeymapEntry("SKK_JMODE", "keycode::0x0a");
entry >> key;
- assert(key == SKKKeyState::Keycode(0x0a, false));
+ assert(key == SKKKeyState::KeyCode(0x0a, false));
entry = SKKKeymapEntry("SKK_ENTER", "hex::0x03");
entry >> key;
- assert(key == SKKKeyState::Ascii(0x03, false));
+ assert(key == SKKKeyState::CharCode(0x03, false));
entry = SKKKeymapEntry("SKK_ENTER", "ctrl::m");
entry >> key;
- assert(key == SKKKeyState::Ascii('m', true));
+ assert(key == SKKKeyState::CharCode('m', SKKKeyState::CTRL));
entry = SKKKeymapEntry("Direct", "group::a,c,d-f");
assert(!entry.IsEvent());
assert(entry.Symbol() == Direct);
entry >> key;
- assert(key == SKKKeyState::Ascii('a', false));
+ assert(key == SKKKeyState::CharCode('a', false));
entry >> key;
- assert(key == SKKKeyState::Ascii('c', false));
+ assert(key == SKKKeyState::CharCode('c', false));
entry >> key;
- assert(key == SKKKeyState::Ascii('d', false));
+ assert(key == SKKKeyState::CharCode('d', false));
entry >> key;
- assert(key == SKKKeyState::Ascii('e', false));
+ assert(key == SKKKeyState::CharCode('e', false));
entry >> key;
- assert(key == SKKKeyState::Ascii('f', false));
+ assert(key == SKKKeyState::CharCode('f', false));
}
Index: AquaSKK/src/test/SKKKeymap_TEST.cpp
diff -u AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.3 AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.4
--- AquaSKK/src/test/SKKKeymap_TEST.cpp:1.1.2.3 Tue Sep 11 23:08:20 2007
+++ AquaSKK/src/test/SKKKeymap_TEST.cpp Sun Oct 14 18:07:09 2007
@@ -1,19 +1,20 @@
#include <iostream>
#include "SKKKeymap.h"
#include "SKKKeymapEntry.h"
+#include "SKKKeyState.h"
int main() {
SKKKeymap keymap;
SKKEventParam param;
- keymap.Initialize("../keybindings/keymap.conf");
+ keymap.Initialize("keymap.conf");
assert(keymap.Fetch(0, 0, 0) == SKKEventParam(SKK_CHAR, 0, 0));
- assert(keymap.Fetch('j', 0, true) == SKKEventParam(SKK_JMODE, 'j', 0));
+ assert(keymap.Fetch('j', 0, SKKKeyState::CTRL) == SKKEventParam(SKK_JMODE, 'j', 0));
assert(keymap.Fetch(0x03, 0, 0) == SKKEventParam(SKK_ENTER, 0x03, 0));
assert(keymap.Fetch(0x09, 0, 0) == SKKEventParam(SKK_TAB, 0x09, 0));
- assert(keymap.Fetch('i', 0, true) == SKKEventParam(SKK_TAB, 'i', 0));
- assert(keymap.Fetch('g', 0, true) == SKKEventParam(SKK_CANCEL, 'g', 0));
+ assert(keymap.Fetch('i', 0, SKKKeyState::CTRL) == SKKEventParam(SKK_TAB, 'i', 0));
+ assert(keymap.Fetch('g', 0, SKKKeyState::CTRL) == SKKEventParam(SKK_CANCEL, 'g', 0));
assert(keymap.Fetch(0x1c, 0, 0) == SKKEventParam(SKK_LEFT, 0x1c, 0));
param = keymap.Fetch('b', 0, 0);
@@ -22,7 +23,7 @@
param = keymap.Fetch('q', 0, 0);
assert(param == SKKEventParam(SKK_CHAR, 'q', ToggleKana));
- param = keymap.Fetch('q', 0, true);
+ param = keymap.Fetch('q', 0, SKKKeyState::CTRL);
assert(param == SKKEventParam(SKK_CHAR, 'q', ToggleJisx0201Kana));
param = keymap.Fetch('A', 0, 0);
@@ -31,6 +32,12 @@
param = keymap.Fetch('1', 0x51, 0);
assert(param == SKKEventParam(SKK_CHAR, '1', Direct));
- param = keymap.Fetch('f', 0, true);
+ param = keymap.Fetch('f', 0, SKKKeyState::CTRL);
assert(param == SKKEventParam(SKK_RIGHT, 'f', 0));
+
+ param = keymap.Fetch(0x20, 0, SKKKeyState::SHIFT);
+ assert(param == SKKEventParam(SKK_CHAR, 0x20, PrevCandidate));
+
+ param = keymap.Fetch('v', 0, SKKKeyState::META);
+ assert(param == SKKEventParam(SKK_PASTE, 'v', 0));
}
Index: AquaSKK/src/test/keymap.conf
diff -u /dev/null AquaSKK/src/test/keymap.conf:1.1.2.1
--- /dev/null Sun Oct 14 18:07:10 2007
+++ AquaSKK/src/test/keymap.conf Sun Oct 14 18:07:09 2007
@@ -0,0 +1,43 @@
+###
+### keymap.conf
+###
+
+# ======================================================================
+# event section
+# ======================================================================
+
+SKK_JMODE ctrl::j
+SKK_ENTER group::hex::0x03,0x0a,0x0d||ctrl::m
+SKK_CANCEL ctrl::g
+SKK_BACKSPACE hex::0x08
+SKK_BACKSPACE ctrl::h
+SKK_DELETE hex::0x7f||ctrl::d
+SKK_TAB hex::0x09||ctrl::i
+SKK_PASTE ctrl::y||meta::v
+SKK_LEFT hex::0x1c||ctrl::b
+SKK_RIGHT hex::0x1d||ctrl::f
+SKK_UP hex::0x1e||ctrl::p||ctrl::a
+SKK_DOWN hex::0x1f||ctrl::n||ctrl::e
+
+# ======================================================================
+# attribute section(for SKK_CHAR)
+# ======================================================================
+
+ToggleKana q
+ToggleJisx0201Kana ctrl::q
+SwitchToAscii l
+SwitchToJisx0208Latin L
+
+EnterAbbrev /
+EnterJapanese Q
+#EnterJapanese keycode::0x66 # EISU
+#EnterJapanese keycode::0x68 # KANA
+NextCompletion .
+PrevCompletion ,
+NextCandidate hex::0x20
+PrevCandidate x||shift::hex::0x20
+RemoveTrigger X
+
+UpperCases group::A-K,M-P,R-W,Z
+
+Direct group::keycode::0x41,0x43,0x45,0x4b,0x4e,0x51-0x59,0x5b,0x5c,0x5f