Skip to content

Commit

Permalink
deps: download help; use it (DSS_SetPropertiesMO)
Browse files Browse the repository at this point in the history
Enabled some tests that depended on that.
  • Loading branch information
PMeira committed Jul 13, 2022
1 parent 5c0eb46 commit df15ba4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 9 deletions.
23 changes: 23 additions & 0 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@ function download(::Type{Windows})
println("Success")
end

function download_messages()

url = "https://github.com/dss-extensions/dss_capi/releases/download/$(DSS_CAPI_TAG)/messages.zip"
@show url
filename = normpath(joinpath(@__DIR__, "messages.zip"))
Base.download(url, filename)

directory = normpath(@__DIR__)

home = (Base.VERSION < v"0.7-") ? JULIA_HOME : Sys.BINDIR
if Base.VERSION < v"1.3.0"
bin7z = "$home/7z"
else
bin7z = "$(joinpath(home, "..", "libexec", "7z"))"
end

success(`$bin7z x $filename -y -o$directory`)
rm(joinpath(@__DIR__, "messages.zip"), force=true)

println("Success")
end


if Sys.iswindows()
os = Windows
Expand All @@ -100,3 +122,4 @@ else
end

download(os)
download_messages()
3 changes: 3 additions & 0 deletions src/OpenDSSDirect.jl
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ function __init__()
error("$LIBRARY cannot be opened. Please check 'deps/build.log' for more information.")
end

# Load the default descriptions/help strings
Lib.DSS_SetPropertiesMO(abspath(joinpath(@__DIR__, "../deps/messages/properties-en-US.mo")))

if !Sys.islinux()
global commandhelp = Dict{String, String}()
for i in 1:OpenDSSDirect.Executive.NumCommands()
Expand Down
4 changes: 4 additions & 0 deletions src/lib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6341,3 +6341,7 @@ end
function XYCurves_Set_idx(Value)
ccall((:XYCurves_Set_idx, LIBRARY), Cvoid, (Int32,), Value)
end

function DSS_SetPropertiesMO(Value)
ccall((:DSS_SetPropertiesMO, LIBRARY), Cstring, ())
end
5 changes: 2 additions & 3 deletions test/executive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ init8500()
@test Executive.Option(2) == "element"
@test Executive.OptionValue(2) == "vreg4_c"

# Broken until we add the gettext message catalogs
@test_broken Executive.CommandHelp(2)[1:7] == "Edit an"
@test_broken Executive.OptionHelp(2)[1:8] == "Sets the"
@test Executive.CommandHelp(2)[1:7] == "Edit an"
@test Executive.OptionHelp(2)[1:8] == "Sets the"

end # testset
9 changes: 3 additions & 6 deletions test/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,21 @@ OpenDSSDirect.Lib.DSSProperty_Set_Index(-1)
Properties._setCurrentProperty(1)
@test uppercase(Properties.Value()) == "VREG4_C"

# Broken until we add the gettext catalogs
@test_broken replace(Properties.Description(), "\r\n" => "\n") == "Name of Transformer or AutoTrans element to which the RegControl is connected. Do not specify the full object name; \"Transformer\" or \"AutoTrans\" is assumed for the object class. Example:\n\nTransformer=Xfmr1"
@test replace(Properties.Description(), "\r\n" => "\n") == "Name of Transformer or AutoTrans element to which the RegControl is connected. Do not specify the full object name; \"Transformer\" or \"AutoTrans\" is assumed for the object class. Example:\n\nTransformer=Xfmr1"

@test Properties.Name() == "transformer"

Properties._setCurrentProperty("1")
@test uppercase(Properties.Value()) == "VREG4_C"

# Broken until we add the gettext catalogs
@test_broken replace(Properties.Description(), "\r\n" => "\n") == "Name of Transformer or AutoTrans element to which the RegControl is connected. Do not specify the full object name; \"Transformer\" or \"AutoTrans\" is assumed for the object class. Example:\n\nTransformer=Xfmr1"
@test replace(Properties.Description(), "\r\n" => "\n") == "Name of Transformer or AutoTrans element to which the RegControl is connected. Do not specify the full object name; \"Transformer\" or \"AutoTrans\" is assumed for the object class. Example:\n\nTransformer=Xfmr1"

@test Properties.Name() == "transformer"

Properties._setCurrentProperty("transformer")
@test uppercase(Properties.Value()) == "VREG4_C"

# Broken until we add the gettext catalogs
@test_broken replace(Properties.Description(), "\r\n" => "\n") == "Name of Transformer or AutoTrans element to which the RegControl is connected. Do not specify the full object name; \"Transformer\" or \"AutoTrans\" is assumed for the object class. Example:\n\nTransformer=Xfmr1"
@test replace(Properties.Description(), "\r\n" => "\n") == "Name of Transformer or AutoTrans element to which the RegControl is connected. Do not specify the full object name; \"Transformer\" or \"AutoTrans\" is assumed for the object class. Example:\n\nTransformer=Xfmr1"

@test Properties.Name() == "transformer"

Expand Down

0 comments on commit df15ba4

Please sign in to comment.