Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a checker for ktfmt for kotlin files #27658

Merged
merged 13 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert files to master, to validate that our kotlin formatter validat…
…es format
  • Loading branch information
andreilitvin committed Jul 7, 2023
commit ff38fce70f193eee4d51afff2dcb72aea19f5734
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.tcl.chip.chiptest

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.*
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -19,4 +21,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.tcl.chip.chiptest", appContext.packageName)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,50 @@ import androidx.appcompat.app.AppCompatActivity
import chip.platform.*
import com.tcl.chip.chiptest.databinding.ActivityMainBinding


class MainActivity : AppCompatActivity() {

private val msgShowLog = 1

private lateinit var binding: ActivityMainBinding
private val mainHandler: Handler =
object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
when (msg.what) {
msgShowLog -> {
binding.testLog.append(msg.obj.toString())
}
private val mainHandler: Handler = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
super.handleMessage(msg)
when (msg.what) {
msgShowLog -> {
binding.testLog.append(msg.obj.toString())
}
}
}
}

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)

binding.testLog.movementMethod = ScrollingMovementMethod()
binding.testLog.movementMethod = ScrollingMovementMethod();
TestEngine.setListener { log ->
var msg = mainHandler.obtainMessage(msgShowLog, log)
mainHandler.sendMessage(msg)
}

binding.runButton.setOnClickListener {
binding.testLog.text = ""
Thread {
var ret = TestEngine.runTest()
Thread{
var ret = TestEngine.runTest();

var log: String =
if (ret == 0) {
getString(R.string.test_finished)
} else {
getString(R.string.test_failed, ret)
}
var msg = mainHandler.obtainMessage(msgShowLog, log)
mainHandler.sendMessage(msg)
var log:String = if (ret == 0) {
getString(R.string.test_finished)
} else {
getString(R.string.test_failed,ret)
}
.start()
var msg = mainHandler.obtainMessage(msgShowLog, log)
mainHandler.sendMessage(msg)
}.start()
}

AndroidChipPlatform(
AndroidBleManager(),
PreferencesKeyValueStoreManager(this),
PreferencesConfigurationManager(this),
NsdManagerServiceResolver(this),
NsdManagerServiceBrowser(this),
ChipMdnsCallbackImpl(),
DiagnosticDataProviderImpl(this)
)
AndroidChipPlatform(AndroidBleManager(), PreferencesKeyValueStoreManager(this), PreferencesConfigurationManager(this), NsdManagerServiceResolver(this), NsdManagerServiceBrowser(this), ChipMdnsCallbackImpl(), DiagnosticDataProviderImpl(this))
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.tcl.chip.chiptest

import org.junit.Assert.*
import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
Expand All @@ -13,4 +14,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}
Loading