@@ -2051,7 +2051,7 @@ static Function TestVariablePlottingDoesNotModifyData()
20512051 graphBase = BSP_GetFormulaGraph ( win)
20522052 graph = graphBase + "_#Graph" + "0"
20532053
2054- ExecuteSweepFormulaInDB ( code , win )
2054+ ExecuteSweepFormulaCode ( win , code )
20552055 REQUIRE_EQUAL_VAR ( WindowExists ( graph) , 1 )
20562056
20572057 WAVE /WAVE varStorage = GetSFVarStorage ( win)
@@ -2077,7 +2077,7 @@ static Function TestVariablePlottingDifferentSubsequentBaseTypes()
20772077 graphBase = BSP_GetFormulaGraph ( win)
20782078 graph = graphBase + "_#Graph" + "0"
20792079
2080- ExecuteSweepFormulaInDB ( code , win )
2080+ ExecuteSweepFormulaCode ( win , code )
20812081 REQUIRE_EQUAL_VAR ( WindowExists ( graph) , 1 )
20822082 WAVE /WAVE varStorage = GetSFVarStorage ( win)
20832083 WAVE /WAVE dataRef = SFH_AttemptDatasetResolve ( WaveText ( WaveRef ( varStorage, row = FindDimLabel ( varStorage, ROWS, "data" )) , row = 0 ))
@@ -2090,7 +2090,7 @@ static Function TestVariablePlottingDifferentSubsequentBaseTypes()
20902090 Make / N=3 root: testData = p
20912091
20922092 code = "data=wave(root:testData)\r $data"
2093- ExecuteSweepFormulaInDB ( code , win )
2093+ ExecuteSweepFormulaCode ( win , code )
20942094
20952095 WAVE /WAVE varStorage = GetSFVarStorage ( win)
20962096 WAVE /WAVE dataRef = SFH_AttemptDatasetResolve ( WaveText ( WaveRef ( varStorage, row = FindDimLabel ( varStorage, ROWS, "data" )) , row = 0 ))
@@ -2114,7 +2114,7 @@ static Function TestVariableReadOnly()
21142114 Make / N=100 root: testData = p + offset
21152115
21162116 code = "data=wave(root:testData)\r powerspectrum($data)"
2117- ExecuteSweepFormulaInDB ( code , win )
2117+ ExecuteSweepFormulaCode ( win , code )
21182118
21192119 WAVE /WAVE varStorage = GetSFVarStorage ( win)
21202120 WAVE /WAVE dataRef = SFH_AttemptDatasetResolve ( WaveText ( WaveRef ( varStorage, row = FindDimLabel ( varStorage, ROWS, "data" )) , row = 0 ))
@@ -2144,7 +2144,7 @@ static Function TestKeepsUnitsWhenMappingMultipleYToOne()
21442144 SetScale / P y, 0, 1, "y2" , data2
21452145
21462146 code = "dataset(wave(data1), wave(data1)) vs dataset(wave(data2))"
2147- ExecuteSweepFormulaInDB ( code , win )
2147+ ExecuteSweepFormulaCode ( win , code )
21482148 yAxis = AxisLabel ( graph, "left" )
21492149 CHECK_EQUAL_STR ( yAxis, "(y1)" )
21502150 xAxis = AxisLabel ( graph, "bottom" )
@@ -2175,11 +2175,63 @@ static Function TestAxisLabelGathering()
21752175 code = "wave(data1)\r " + \
21762176 "with \r " + \
21772177 "wave(data2) vs wave(data3)\r "
2178- ExecuteSweepFormulaInDB ( code , win )
2178+ ExecuteSweepFormulaCode ( win , code )
21792179 yAxis = AxisLabel ( graph, "left" )
21802180 CHECK_EQUAL_STR ( yAxis, "(y1) / (y2)" )
21812181 xAxis = AxisLabel ( graph, "bottom" )
21822182 CHECK_EQUAL_STR ( xAxis, "(x1) / (x3)" )
21832183
21842184 KillWaves / Z data1, data2, data3
21852185End
2186+
2187+ static Function TestTraceColor ( string graph, string traces, variable index, WAVE colors)
2188+
2189+ string info, trace
2190+
2191+ trace = StringFromList ( index, traces)
2192+ CHECK_PROPER_STR ( trace)
2193+
2194+ info = TraceInfo ( graph, trace, 0 )
2195+ CHECK_PROPER_STR ( info)
2196+
2197+ WAVE traceColors = NumericWaveByKey ( "rgb(x)" , info, keySep = "=" , listSep = ";" )
2198+ CHECK_EQUAL_WAVES ( traceColors, colors, mode = WAVE_DATA)
2199+ End
2200+
2201+ static Function TestTraceColors ()
2202+
2203+ string win, device, code, graph, winBase, traces, trace, info
2204+
2205+ [ win, device] = CreateEmptyUnlockedDataBrowserWindow ()
2206+
2207+ win = CreateFakeSweepData ( win, device, sweepNo = 0 )
2208+ win = CreateFakeSweepData ( win, device, sweepNo = 1 )
2209+
2210+ code = "data()"
2211+ winBase = ExecuteSweepFormulaCode ( win, code)
2212+
2213+ graph = winBase + "#Graph0"
2214+
2215+ traces = TraceNameList ( graph, ";" , 1 + 2 )
2216+ CHECK_EQUAL_VAR ( ItemsInList ( traces) , 2 )
2217+
2218+ // these are the per headstage colors
2219+ TestTraceColor ( graph, traces, 0, { 7967, 7710, 7710 })
2220+ TestTraceColor ( graph, traces, 1, { 60395, 52685, 15934 })
2221+
2222+ code = "data(select(selchannels(AD6)))\r with\r data(select(selchannels(AD6)))"
2223+ winBase = ExecuteSweepFormulaCode ( win, code)
2224+
2225+ graph = winBase + "#Graph0"
2226+
2227+ traces = TraceNameList ( graph, ";" , 1 + 2 )
2228+ CHECK_EQUAL_VAR ( ItemsInList ( traces) , 2 )
2229+
2230+ // color groups:
2231+ // black
2232+ TestTraceColor ( graph, traces, 0, { 0, 0, 0 })
2233+
2234+ // and
2235+ // yellow
2236+ TestTraceColor ( graph, traces, 1, { 59110, 40863, 0 })
2237+ End
0 commit comments