mirror of
https://github.com/mii443/AzooKeyKanaKanjiConverter.git
synced 2025-08-22 15:05:26 +00:00
Merge pull request #174 from azooKey/feat/update_emoji16.0
feat: use emoji 16.0
This commit is contained in:
@ -58,9 +58,11 @@ public extension TextReplacer {
|
||||
static func withDefaultEmojiDictionary() -> Self {
|
||||
self.init {
|
||||
let directoryName = "EmojiDictionary"
|
||||
#if os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
#if os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
|
||||
let directory = Bundle.module.bundleURL.appendingPathComponent(directoryName, isDirectory: true)
|
||||
return if #available(iOS 17.4, *) {
|
||||
return if #available(iOS 18.4, *) {
|
||||
directory.appendingPathComponent("emoji_all_E16.0.txt", isDirectory: false)
|
||||
} else if #available(iOS 17.4, *) {
|
||||
directory.appendingPathComponent("emoji_all_E15.1.txt", isDirectory: false)
|
||||
} else if #available(iOS 16.4, *) {
|
||||
directory.appendingPathComponent("emoji_all_E15.0.txt", isDirectory: false)
|
||||
@ -71,7 +73,9 @@ public extension TextReplacer {
|
||||
}
|
||||
#elseif os(macOS)
|
||||
let directory = Bundle.module.resourceURL!.appendingPathComponent(directoryName, isDirectory: true)
|
||||
return if #available(macOS 14.4, *) {
|
||||
return if #available(macOS 15.3, *) {
|
||||
directory.appendingPathComponent("emoji_all_E16.0.txt", isDirectory: false)
|
||||
} else if #available(macOS 14.4, *) {
|
||||
directory.appendingPathComponent("emoji_all_E15.1.txt", isDirectory: false)
|
||||
} else {
|
||||
directory.appendingPathComponent("emoji_all_E15.0.txt", isDirectory: false)
|
||||
@ -79,7 +83,7 @@ public extension TextReplacer {
|
||||
#else
|
||||
return Bundle.module.resourceURL!
|
||||
.appendingPathComponent(directoryName, isDirectory: true)
|
||||
.appendingPathComponent("emoji_all_E15.1.txt", isDirectory: false)
|
||||
.appendingPathComponent("emoji_all_E16.0.txt", isDirectory: false)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,15 @@ final class TextReplacerTests: XCTestCase {
|
||||
func testEmojiTextReplacer() throws {
|
||||
let textReplacer = TextReplacer.withDefaultEmojiDictionary()
|
||||
XCTAssertFalse(textReplacer.isEmpty)
|
||||
let searchResult = textReplacer.getSearchResult(query: "カニ", target: [.emoji])
|
||||
XCTAssertEqual(searchResult.count, 1)
|
||||
XCTAssertEqual(searchResult[0], .init(query: "かに", text: "🦀️"))
|
||||
do {
|
||||
let searchResult = textReplacer.getSearchResult(query: "カニ", target: [.emoji])
|
||||
XCTAssertEqual(searchResult.count, 1)
|
||||
XCTAssertEqual(searchResult[0], .init(query: "かに", text: "🦀️"))
|
||||
}
|
||||
if #available(iOS 18.4, macOS 15.3, *) {
|
||||
let searchResult = textReplacer.getSearchResult(query: "テツヤ", target: [.emoji])
|
||||
XCTAssertEqual(searchResult.count, 1)
|
||||
XCTAssertEqual(searchResult[0], .init(query: "てつや", text: "️"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user