@@ -5,8 +5,28 @@ import (
55 "wox/plugin"
66)
77
8+ const calculatorPluginID = "bd723c38-f28d-4152-8621-76fd21d6456e"
9+
10+ func setCalculatorSeparatorMode (t * testing.T , mode string ) {
11+ t .Helper ()
12+ var calcInstance * plugin.Instance
13+ for _ , instance := range plugin .GetPluginManager ().GetPluginInstances () {
14+ if instance .Metadata .Id == calculatorPluginID {
15+ calcInstance = instance
16+ break
17+ }
18+ }
19+ if calcInstance == nil {
20+ t .Fatal ("Calculator plugin instance not found" )
21+ }
22+ if err := calcInstance .Setting .Set ("SeparatorMode" , mode ); err != nil {
23+ t .Fatalf ("Failed to set separator mode: %v" , err )
24+ }
25+ }
26+
827func TestCalculatorBasic (t * testing.T ) {
928 suite := NewTestSuite (t )
29+ setCalculatorSeparatorMode (t , "Dot" )
1030
1131 tests := []QueryTest {
1232 {
@@ -88,6 +108,7 @@ func TestCalculatorBasic(t *testing.T) {
88108
89109func TestCalculatorTrigonometric (t * testing.T ) {
90110 suite := NewTestSuite (t )
111+ setCalculatorSeparatorMode (t , "Dot" )
91112
92113 tests := []QueryTest {
93114 {
@@ -117,7 +138,7 @@ func TestCalculatorTrigonometric(t *testing.T) {
117138 {
118139 Name : "Tangent" ,
119140 Query : "tan(pi/4)" ,
120- ExpectedTitle : "0.9999999999999998 " ,
141+ ExpectedTitle : "1 " ,
121142 ExpectedAction : "Copy" ,
122143 },
123144 }
@@ -127,6 +148,7 @@ func TestCalculatorTrigonometric(t *testing.T) {
127148
128149func TestCalculatorAdvanced (t * testing.T ) {
129150 suite := NewTestSuite (t )
151+ setCalculatorSeparatorMode (t , "Dot" )
130152
131153 tests := []QueryTest {
132154 {
@@ -244,6 +266,7 @@ func TestCalculatorAdvanced(t *testing.T) {
244266
245267func TestCalculatorSeparators (t * testing.T ) {
246268 suite := NewTestSuite (t )
269+ setCalculatorSeparatorMode (t , "Dot" )
247270 calculatorId := "bd723c38-f28d-4152-8621-76fd21d6456e"
248271
249272 // Find the plugin instance to ensure we update the correct setting store
0 commit comments