package com.dong.demo013.debug

import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

@Composable
internal fun DebugTestDemo() {
    Column(
        modifier = Modifier.fillMaxSize().padding(16.dp),
        verticalArrangement = Arrangement.spacedBy(16.dp)
    ) {

        Button(
            onClick = {
                allBreakpoints()
            },

            ) {
            Text("断点测试", color = Color.White)
        }
        Button(
            onClick = {
                getJsons();
            },

            ) {
            Text("所有基础变量", color = Color.White)
        }
        Button(
            onClick = {
                complexObject();
            },

            ) {
            Text("复杂对象", color = Color.White)
        }

        Button(
            onClick = {
                print("打印console调试信息")
            },

            ) {
            Text("console信息打印)", color = Color.White)
        }


    }



}

/******所有类型的断点*
 * 普通断点
 * 条件断点
 * 普通变量
 * 复杂对象
 * ***/

fun allBreakpoints(){
    getJsons()
    testIfBreakpoint()
    testCommonBreakpoint()
    complexObject()
    testConditionalBreakpoint()
}




/***变量类型**/
fun getJsons(){
   // val allTypes= DebugAllTypesData ();
    val testInt: Int=2026;
    print("基础变量查看）")//断点基础变量查看
}

//复杂对象
fun complexObject(){
    val testObject=ComplexClass();
    print(testObject) //断点复杂变量查看
}


/***断点类型**/
fun testCommonBreakpoint() {
    val a: Int=1;
    print("a=1");//普通断点设置处
    val b: Int=2;
    print("b=2");//普通断点禁用设置
    val c: Int=3;
    print("c=3");//普通断点设置处2
}

//测试条件断点
fun testIfBreakpoint() {
    for (currentIndex in 1..10){
        //条件断点 currentIndex==5
        println("条件断点命中进入")//条件断点设置处
    }
}

//表达式断点
fun testConditionalBreakpoint() {
    //打印
    var testConditionIndex: Int=1;
    for (currentIndex in 1..100000){
        if(currentIndex<5){
            //正常只能看testConditionIndex+1 5次的
            testConditionIndex=testConditionIndex+1;
            //使用表达式可以观察1000次+1循环的数据
            //在表达式窗口中输入testConditionIndex+1000
            println("表达式断点命中进入")//表达式断点设置处
        }

    }
}