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 = {
                tenComplexObject();
            },

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



    }



}

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

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

}




/***变量类型**/
fun getJsons(){
    val testInt :Int = 2026;
    print("基础变量查看）")//断点基础变量查看
    val testStr :String="测试变量字符串";
    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 threeComplexObject() {
    val testObject= ComplexThreeClass();
    print("普通复杂对象查看")//普通复杂变量查看时间
}

fun tenComplexObject(){
    val testObject= DebugAllTypesData();
    print(testObject.intArray)//全类型复杂对象查看时间
}

//测试条件断点
fun testIfBreakpoint() {
    for (currentIndex in 1..10){
        //条件断点 currentIndex==5
        //设置条件不满足 currentIndex=100
        print("1");
        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("表达式断点命中进入")//表达式断点设置处
        }

    }
}