mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
* Filter out emojis from text when finding initials * Confirm non-English non-emoji unicde isn't filtered * Remove unused example unit test --------- Co-authored-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
e11d726e27
commit
24abd1ac4a
3 changed files with 21 additions and 50 deletions
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2025 Meshtastic LLC
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.geeksville.mesh
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
|
|
@ -18,22 +18,25 @@
|
|||
package com.geeksville.mesh.ui
|
||||
|
||||
import com.geeksville.mesh.model.getInitials
|
||||
import org.junit.Assert
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class UIUnitTest {
|
||||
@Test
|
||||
fun initialsGood() {
|
||||
Assert.assertEquals("KH", getInitials("Kevin Hester"))
|
||||
Assert.assertEquals("KHLC", getInitials(" Kevin Hester Lesser Cat "))
|
||||
Assert.assertEquals("", getInitials(" "))
|
||||
Assert.assertEquals("gksv", getInitials("geeksville"))
|
||||
Assert.assertEquals("geek", getInitials("geek"))
|
||||
Assert.assertEquals("gks1", getInitials("geeks1"))
|
||||
assertEquals("KH", getInitials("Kevin Hester"))
|
||||
assertEquals("KHLC", getInitials(" Kevin Hester Lesser Cat "))
|
||||
assertEquals("", getInitials(" "))
|
||||
assertEquals("gksv", getInitials("geeksville"))
|
||||
assertEquals("geek", getInitials("geek"))
|
||||
assertEquals("gks1", getInitials("geeks1"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun ignoreEmojisWhenCreatingInitials() {
|
||||
assertEquals("TG", getInitials("The \uD83D\uDC10 Goat"))
|
||||
assertEquals("TT", getInitials("The \uD83E\uDD14Thinker"))
|
||||
assertEquals("TCH", getInitials("\uD83D\uDC4F\uD83C\uDFFFThe Clapping Hands"))
|
||||
assertEquals("山羊", getInitials("山羊\uD83D\uDC10"))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue