Skip to content

Commit 00715a6

Browse files
authored
Empty test setup (#7)
1 parent dbf83bd commit 00715a6

File tree

7 files changed

+130
-5
lines changed

7 files changed

+130
-5
lines changed

Diff for: .gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "third_party/googletest"]
2+
path = third_party/googletest
3+
url = https://github.com/google/googletest.git

Diff for: CMakeLists.txt

+23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cmake_minimum_required(VERSION 3.0)
22
project(fcitx5-cskk VERSION 0.2.0)
3+
set(CMAKE_CXX_FLAGS "-Wall")
34
set(CMAKE_CXX_STANDARD 20)
45

56
find_package(ECM 1.0.0 REQUIRED)
@@ -14,6 +15,27 @@ pkg_check_modules(LIBCSKK REQUIRED "cskk>=0.1.0")
1415

1516
include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
1617

18+
find_package(Git QUIET)
19+
if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
20+
enable_testing()
21+
option(GOOGLETEST "Check Google Test during build" OFF)
22+
# -DGOOGLETEST=on を付けて実行したらsubmoduleを最新版にする
23+
if (GOOGLETEST)
24+
message(STATUS "Submodule update")
25+
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
26+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
27+
RESULT_VARIABLE GIT_SUBMOD_RESULT)
28+
if (NOT GIT_SUBMOD_RESULT EQUAL "0")
29+
message(FATAL_ERROR "git submodule update --init failed with ${GIT_SUBMOD_RESULT}, please checkout submodules")
30+
endif ()
31+
endif ()
32+
endif ()
33+
34+
if (NOT EXISTS "${PROJECT_SOURCE_DIR}/third_party/googletest/CMakeLists.txt")
35+
message(FATAL_ERROR "The submodules were not downloaded! GOOGLETEST was turned off or failed. Please update submodules and try again.")
36+
endif ()
37+
38+
1739
# Not sure what this does. Need translation?
1840
find_package(Gettext REQUIRED)
1941
add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-cskk\" -D_GNU_SOURCE)
@@ -22,6 +44,7 @@ fcitx5_add_i18n_definition()
2244
add_subdirectory(src)
2345
add_subdirectory(data)
2446
add_subdirectory(po)
47+
add_subdirectory(test)
2548

2649
fcitx5_translate_desktop_file(
2750
org.fcitx.Fcitx5.Addon.Cskk.metainfo.xml.in

Diff for: README.md

+46-5
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,62 @@ libcskk (https://github.com/naokiri/cskk) を用いる。
55

66
## インストール方法
77

8+
$ rm -rf ./build
89
$ mkdir build
9-
$ cd build
10+
$ cd build
1011
$ cmake ..
1112
$ make && make install
1213

1314
## アンインストール方法
1415

16+
$ cd build
1517
$ make uninstall
1618

17-
## 開発状況
18-
Dogfoodable.
19+
## テスト実行方法
20+
21+
$ rm -rf ./build
22+
$ mkdir build
23+
$ cd build
24+
$ cmake -DGOOGLETEST=on ..
25+
$ make runTest
26+
$ ./test/runTest
1927

20-
ひらがなにゅうりょくできる
28+
GOOGLETESTフラグはキャッシュされるのでライブラリ生成時には注意が必要
29+
30+
## 開発状況
31+
### 実装予定(いつかは)
32+
- [x] ひらがな・カタカナ・漢字入力
33+
- [x] 変換候補リスト表示
34+
- [ ] 変換候補リスト ラベル選択
35+
36+
- 設定項目
37+
- [x] 入力モード初期値設定
38+
- [ ] 漢字変換候補ラベル((a,b,c...), (1,2,3...) etc.)
39+
- [ ] 句読点スタイル ((,.),(、。),(、.)... )
40+
- [ ] 変換候補リスト表示までの変換候補数
41+
- [ ] 変換候補リストのサイズ
42+
43+
### 実装内容・予定不明
44+
- [ ] 優先度、読み書き可不可の辞書リスト設定
2145

22-
漢字も変換できる。
2346

2447
### じしょ
2548
いまのところとりあえず、レギュラーファイルの $XDG_DATA_HOME/fcitx5-cskk/dictionary/* をまずよみかきじしょとして、 $XDG_DATA_DIRS/fcitx5-cskk/dictionary/* をよみとりせんようじしょにする。このじゅんばんで、おのおのファイルめいじゅん。 utf-8
49+
50+
## 著作権表示
51+
52+
Copyright (C) 2021 Naoaki Iwakiri
53+
54+
## ライセンス
55+
GNU GPL v3 or later.
56+
57+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
58+
License as published by the Free Software Foundation, either version 3 of the License, or
59+
(at your option) any later version.
60+
61+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
62+
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
63+
64+
You should have received a copy of the GNU General Public License along with this program. If not,
65+
see <https://www.gnu.org/licenses/>.
66+

Diff for: test/CMakeLists.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
if (GOOGLETEST)
2+
message("Setting up test")
3+
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/googletest ${PROJECT_SOURCE_DIR}/third_party/googletest/build)
4+
enable_testing()
5+
add_executable(runTest ${PROJECT_SOURCE_DIR}/test/main.cpp ${PROJECT_SOURCE_DIR}/test/basic_test.cpp)
6+
7+
target_include_directories(
8+
runTest PUBLIC
9+
${PROJECT_SOURCE_DIR}/third_party/googletest/googletest/include
10+
)
11+
target_link_libraries(
12+
runTest
13+
gtest
14+
)
15+
16+
add_test(NAME runTest COMMAND runTest)
17+
endif ()

Diff for: test/basic_test.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2021 Naoaki Iwakiri
3+
* This program is released under GNU General Public License version 3 or later
4+
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
5+
*
6+
* Creation Date: 2021-05-08
7+
*
8+
* SPDX-License-Identifier: GPL-3.0-or-later
9+
* SPDX-FileType: SOURCE
10+
* SPDX-FileName: basic_test.cpp
11+
* SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
12+
*/
13+
14+
#include "gtest/gtest.h"
15+
// TODO: Add real test
16+
// Test to check that test compiles...
17+
class TestTest : public ::testing::Test {};
18+
19+
TEST_F(TestTest, A) { EXPECT_EQ(1, 1); }
20+
TEST_F(TestTest, B) { EXPECT_EQ(1, 2); }

Diff for: test/main.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (c) 2021 Naoaki Iwakiri
3+
* This program is released under GNU General Public License version 3 or later
4+
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
5+
*
6+
* Creation Date: 2021-05-08
7+
*
8+
* SPDX-License-Identifier: GPL-3.0-or-later
9+
* SPDX-FileType: SOURCE
10+
* SPDX-FileName: main.cpp
11+
* SPDX-FileCopyrightText: Copyright (c) 2021 Naoaki Iwakiri
12+
*/
13+
14+
#include "gtest/gtest.h"
15+
16+
int main(int argc, char** argv) {
17+
::testing::InitGoogleTest(&argc, argv);
18+
return RUN_ALL_TESTS();
19+
}
20+

Diff for: third_party/googletest

Submodule googletest added at f5e592d

0 commit comments

Comments
 (0)