Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • ChenZhangg-Modify_GRADLE_1
  • attachments
  • demo-jump-in-history
  • jetpack-compose-rewrite
  • main
  • wip
  • 1.4.0
  • 1.4.1
  • 1.4.2
  • 1.4.3
  • 1.4.4
  • 1.5.0
  • 1.5.1
  • 1.5.2
  • 1.5.3
  • 1.6.0
  • 1.6.1
  • 1.6.2
  • 1.7.0
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.5.0
  • v1.0.0
  • v1.0.1
  • v1.0.10
  • v1.0.11
  • v1.0.12
  • v1.0.13
  • v1.0.14
  • v1.0.15
  • v1.0.16
  • v1.0.17
  • v1.0.18
  • v1.0.19
  • v1.0.2
  • v1.0.20
  • v1.0.21
  • v1.0.22
  • v1.0.23
  • v1.0.25
  • v1.0.26
  • v1.0.27
  • v1.0.28
  • v1.0.29
  • v1.0.3
  • v1.0.31
  • v1.0.35
  • v1.0.36
  • v1.0.37
  • v1.0.38
  • v1.0.39
  • v1.0.4
  • v1.0.40
  • v1.0.41
  • v1.0.42
  • v1.0.43
  • v1.0.44
  • v1.0.45
  • v1.0.5
  • v1.0.6
  • v1.0.7
  • v1.0.8
  • v1.0.9
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.1.3
  • v1.1.4
  • v1.2.1
  • v1.2.10
  • v1.2.11
  • v1.2.12
  • v1.2.13
  • v1.2.14
  • v1.2.15
  • v1.2.16
  • v1.2.17
  • v1.2.18
  • v1.2.19
  • v1.2.2
  • v1.2.20
  • v1.2.21
  • v1.2.22
  • v1.2.23
  • v1.2.24
  • v1.2.25
  • v1.2.26
  • v1.2.27
  • v1.2.28
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.9
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.3.3
100 results

Target

Select target project
  • justJanne/QuasselDroid-ng
1 result
Select Git revision
  • ChenZhangg-Modify_GRADLE_1
  • attachments
  • demo-jump-in-history
  • jetpack-compose-rewrite
  • main
  • wip
  • 1.4.0
  • 1.4.1
  • 1.4.2
  • 1.4.3
  • 1.4.4
  • 1.5.0
  • 1.5.1
  • 1.5.2
  • 1.5.3
  • 1.6.0
  • 1.6.1
  • 1.6.2
  • 1.7.0
  • v0.2.0
  • v0.3.0
  • v0.4.0
  • v0.5.0
  • v1.0.0
  • v1.0.1
  • v1.0.10
  • v1.0.11
  • v1.0.12
  • v1.0.13
  • v1.0.14
  • v1.0.15
  • v1.0.16
  • v1.0.17
  • v1.0.18
  • v1.0.19
  • v1.0.2
  • v1.0.20
  • v1.0.21
  • v1.0.22
  • v1.0.23
  • v1.0.25
  • v1.0.26
  • v1.0.27
  • v1.0.28
  • v1.0.29
  • v1.0.3
  • v1.0.31
  • v1.0.35
  • v1.0.36
  • v1.0.37
  • v1.0.38
  • v1.0.39
  • v1.0.4
  • v1.0.40
  • v1.0.41
  • v1.0.42
  • v1.0.43
  • v1.0.44
  • v1.0.45
  • v1.0.5
  • v1.0.6
  • v1.0.7
  • v1.0.8
  • v1.0.9
  • v1.1.0
  • v1.1.1
  • v1.1.2
  • v1.1.3
  • v1.1.4
  • v1.2.1
  • v1.2.10
  • v1.2.11
  • v1.2.12
  • v1.2.13
  • v1.2.14
  • v1.2.15
  • v1.2.16
  • v1.2.17
  • v1.2.18
  • v1.2.19
  • v1.2.2
  • v1.2.20
  • v1.2.21
  • v1.2.22
  • v1.2.23
  • v1.2.24
  • v1.2.25
  • v1.2.26
  • v1.2.27
  • v1.2.28
  • v1.2.3
  • v1.2.4
  • v1.2.5
  • v1.2.6
  • v1.2.7
  • v1.2.9
  • v1.3.0
  • v1.3.1
  • v1.3.2
  • v1.3.3
100 results
Show changes
Commits on Source (1)
......@@ -26,6 +26,7 @@ import de.kuschku.libquassel.quassel.syncables.interfaces.IBufferViewConfig
import de.kuschku.libquassel.session.SignalProxy
import de.kuschku.libquassel.util.flag.hasFlag
import de.kuschku.libquassel.util.helper.clampOf
import de.kuschku.libquassel.util.irc.IrcCaseMappers
import io.reactivex.Observable
import io.reactivex.subjects.BehaviorSubject
......@@ -327,12 +328,12 @@ class BufferViewConfig constructor(
fun insertBufferSorted(info: BufferInfo, bufferSyncer: BufferSyncer) {
if (!_buffers.contains(info.bufferId)) {
val position = if (_sortAlphabetically) {
val sortedBuffers = _buffers.mapNotNull { bufferSyncer.bufferInfo(it)?.bufferName }
-sortedBuffers.binarySearch(info.bufferName)
} else {
_buffers.size
}
val element = IrcCaseMappers.unicode.toLowerCaseNullable(info.bufferName)
val position =
if (_sortAlphabetically) -_buffers.mapNotNull {
IrcCaseMappers.unicode.toLowerCaseNullable(bufferSyncer.bufferInfo(it)?.bufferName)
}.binarySearch(element) - 1
else _buffers.size
requestAddBuffer(info.bufferId, position)
}
}
......
/*
* Quasseldroid - Quassel client for Android
*
* Copyright (c) 2019 Janne Mareike Koschinski
* Copyright (c) 2019 The Quassel Project
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 as published
* by the Free Software Foundation.
*
* 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 <http://www.gnu.org/licenses/>.
*/
package de.kuschku.libquassel.integration
import de.kuschku.libquassel.protocol.BufferId
import de.kuschku.libquassel.protocol.QType
import de.kuschku.libquassel.protocol.QVariant_
import de.kuschku.libquassel.protocol.Type
import de.kuschku.libquassel.util.TestSession
import de.kuschku.libquassel.util.setupTestSession
import de.kuschku.libquassel.util.with
import org.junit.Before
import org.junit.Test
class BufferViewConfigTest {
lateinit var session: TestSession
@Before
fun setUp() {
session = setupTestSession()
}
// Test positioning of added channel
@Test
fun addChannelAutomatically() = session.with {
val bufferViewConfig = bufferViewManager.bufferViewConfig(0)!!
ensure {
bufferViewConfig.insertBufferSorted(bufferSyncer.bufferInfo(BufferId(4))!!, bufferSyncer)
}.does {
callSync(bufferViewConfig, "requestAddBuffer", listOf(
QVariant_.of(BufferId(4), QType.BufferId),
QVariant_.of(2, Type.Int)
))
}
}
}
......@@ -32,6 +32,15 @@ fun TestSession.with(f: TestSession.() -> Unit) = f.invoke(this)
fun withTestSession(f: TestSession.() -> Unit) = f.invoke(setupTestSession())
fun setupTestSession() = TestSession().provideTestData {
bufferViewConfigs = listOf(
buildBufferViewConfig(0) {
setBufferViewName("All Chats")
addBuffer(BufferId(1), 0)
addBuffer(BufferId(2), 1)
addBuffer(BufferId(3), 2)
}
)
identities = listOf(
buildIdentity(IdentityId(1)) {
setIdentityName("Default Identity")
......
......@@ -219,6 +219,13 @@ class TestSession : ProtocolHandler({ throw it }), ISession {
synchronize(network)
}
fun addBufferViewConfig(bufferViewConfig: BufferViewConfig, initialize: Boolean = false) {
if (!initialize)
bufferViewConfig.initialized = true
bufferViewManager.addBufferViewConfig(bufferViewConfig)
synchronize(bufferViewConfig)
}
override fun removeNetwork(networkId: NetworkId) {
val network = networks.remove(networkId)
stopSynchronize(network)
......@@ -244,6 +251,13 @@ class TestSession : ProtocolHandler({ throw it }), ISession {
return identity
}
fun buildBufferViewConfig(bufferViewConfigId: Int,
f: (BufferViewConfig.() -> Unit)? = null): BufferViewConfig {
val bufferViewConfig = BufferViewConfig(bufferViewConfigId, proxy)
f?.invoke(bufferViewConfig)
return bufferViewConfig
}
data class BufferTestData(
val bufferInfo: BufferInfo,
val activity: Message_Types = Message_Type.of(),
......@@ -254,11 +268,17 @@ class TestSession : ProtocolHandler({ throw it }), ISession {
data class TestData(
val session: TestSession,
var bufferViewConfigs: List<BufferViewConfig> = emptyList(),
var networks: List<Network> = emptyList(),
var identities: List<Identity> = emptyList(),
var buffers: List<BufferTestData> = emptyList(),
var aliases: List<IAliasManager.Alias> = emptyList()
) {
fun buildBufferViewConfig(bufferViewConfigId: Int,
f: (BufferViewConfig.() -> Unit)? = null): BufferViewConfig {
return session.buildBufferViewConfig(bufferViewConfigId, f)
}
fun buildNetwork(networkId: NetworkId, f: (Network.() -> Unit)? = null): Network {
return session.buildNetwork(networkId, f)
}
......@@ -287,6 +307,9 @@ class TestSession : ProtocolHandler({ throw it }), ISession {
fun provideTestData(f: TestData.() -> Unit): TestSession {
val data = TestData(this)
f.invoke(data)
for (bufferViewConfig in data.bufferViewConfigs) {
addBufferViewConfig(bufferViewConfig)
}
for (network in data.networks) {
addNetwork(network)
}
......