obo
11 months ago
4 changed files with 56 additions and 9 deletions
@ -0,0 +1,41 @@
|
||||
package com.fr.design.data.tabledata.tabledatapane; |
||||
|
||||
import com.fr.base.Parameter; |
||||
import com.fr.design.data.datapane.sqlpane.SQLEditPane; |
||||
import com.fr.invoke.Reflect; |
||||
import junit.framework.TestCase; |
||||
import org.junit.Assert; |
||||
|
||||
/** |
||||
* @author Yuan.Wang |
||||
* @since 11.0 |
||||
* Created on 2023/12/22 |
||||
*/ |
||||
public class DBTableDataPaneTest extends TestCase { |
||||
|
||||
public void testGetParameters() { |
||||
DBTableDataPane pane = new DBTableDataPane(); |
||||
SQLEditPane editPane = new SQLEditPane(); |
||||
String sql = "select distinct 类别ID from S产品\n" + |
||||
"where 1=1\n" + |
||||
"order by 类别ID\n" + |
||||
"--${ if(len(comboBox0) = 0,\"\",\"AND 类别00ID = '\" + comboBox0 + \"'\")}"; |
||||
|
||||
String sql1 = "select distinct 类别ID from S产品\n" + |
||||
"where 1=1\n" + |
||||
"order by 类别ID\n" + |
||||
"${ if(len(comboBox0) = 0,\"\",\"AND 类别00ID = '\" + comboBox0 + \"'\")}"; |
||||
editPane.setText(sql); |
||||
Reflect.on(pane).set("sqlTextPane", editPane); |
||||
Reflect.on(pane).set("pageQuery", sql); |
||||
|
||||
Parameter[] parameters = Reflect.on(pane).call("getParameters").get(); |
||||
|
||||
Assert.assertEquals(0, parameters.length); |
||||
editPane.setText(sql1); |
||||
|
||||
parameters = Reflect.on(pane).call("getParameters").get(); |
||||
Assert.assertEquals(1, parameters.length); |
||||
Assert.assertEquals(parameters[0].getName(), "comboBox0"); |
||||
} |
||||
} |
Loading…
Reference in new issue