Permalink
Browse files

Lua unit tests fix

  • Loading branch information...
feragon committed Jul 28, 2016
1 parent bf99b25 commit 8d90ff1e07f5390ba7cec24d16e64008e01ba490
View
@@ -1,6 +1,7 @@
#include "luainterface.h"
LuaInterface::LuaInterface() {
_L = LuaIntf::LuaState::newState();
}
LuaInterface::~LuaInterface() {
@@ -10,8 +11,6 @@ LuaInterface::~LuaInterface() {
}
void LuaInterface::initLua() {
_L = LuaIntf::LuaState::newState();
luaL_openlibs(_L);
luaOpenQtBridge(_L);
lua_openlckernel(_L);
@@ -60,9 +60,9 @@ function ArcOperations:newData(point)
end
function ArcOperations:getArc(center, radius, beginAngle, endAngle)
local d = active_widget():document()
local layer = active_layer()
local a = Arc(center, radius, beginAngle, endAngle, false, layer)
local metaInfo = active_metaInfo()
local a = Arc(center, radius, beginAngle, endAngle, false, layer, metaInfo)
a:setId(self.arc_id)
return a
@@ -57,9 +57,9 @@ function CircleOperations:getCircle(center, radius)
radius = center:distanceTo(radius)
end
local d = active_widget():document()
local layer = active_layer()
local c = Circle(center, radius, layer, active_metaInfo())
local metaInfo = active_metaInfo()
local c = Circle(center, radius, layer, metaInfo)
c:setId(self.circle_id)
return c
@@ -33,9 +33,9 @@ function DimAlignedOperations:_init(id)
end
function DimAlignedOperations:getDimAligned(startPoint, endPoint, middleOfText, text)
local d = active_widget():document()
local layer = active_layer()
local dim = DimAligned.dimAuto(startPoint, endPoint, middleOfText, text, layer, MetaInfo())
local metaInfo = active_metaInfo()
local dim = DimAligned.dimAuto(startPoint, endPoint, middleOfText, text, layer, metaInfo)
dim:setId(self.dimAligned_id)
return dim
@@ -61,8 +61,11 @@ function DimAlignedOperations:newData(data)
message("Click on end point")
elseif(self.endPoint == nil) then
local metaInfo = active_metaInfo()
local layer = active_layer()
self.endPoint = Operations:getCoordinate(data)
self.dimLine = Line(self.startPoint, self.endPoint, Layer("Temp", Color(0,0,0,0)))
self.dimLine = Line(self.startPoint, self.endPoint, layer, metaInfo)
message("Give dimension height")
elseif(self.middleOfText == nil) then
@@ -33,9 +33,9 @@ function DimAngularOperations:_init(id)
end
function DimAngularOperations:getDimAngular(certerPoint, firstPoint, secondPoint, text)
local d = active_widget():document()
local layer = active_layer()
local dim = DimAngular.dimAuto(certerPoint, firstPoint, secondPoint, text, layer, MetaInfo())
local metaInfo = active_metaInfo()
local dim = DimAngular.dimAuto(certerPoint, firstPoint, secondPoint, text, layer, metaInfo)
dim:setId(self.dimAngular_id)
return dim
@@ -31,9 +31,9 @@ function DimDiametricOperations:_init(id)
end
function DimDiametricOperations:getDimDiametric(defPoint1, defPoint2, text)
local d = active_widget():document()
local layer = active_layer()
local dim = DimDiametric(defPoint1, 5, 1, 1, text, defPoint2, 1, layer, MetaInfo())
local metaInfo = active_metaInfo()
local dim = DimDiametric(defPoint1, 5, 1, 1, text, defPoint2, 1, layer, metaInfo)
dim:setId(self.dimDiametric_id)
return dim
@@ -33,9 +33,9 @@ function DimLinearOperations:_init(id)
end
function DimLinearOperations:getDimLinear(startPoint, endPoint, middleOfText, text)
local d = active_widget():document()
local layer = active_layer()
local dim = DimLinear.dimAuto(startPoint, endPoint, middleOfText, text, layer, MetaInfo())
local metaInfo = active_metaInfo()
local dim = DimLinear.dimAuto(startPoint, endPoint, middleOfText, text, layer, metaInfo)
dim:setId(self.dimLinear_id)
return dim
@@ -32,9 +32,9 @@ function DimRadialOperations:_init(id)
end
function DimRadialOperations:getDimRadial(defPoint1, defPoint2, middleOfText, text)
local d = active_widget():document()
local layer = active_layer()
local dim = DimRadial(defPoint1, middleOfText, 5, 0, 1, 1, text, defPoint2, 1, layer, MetaInfo())
local metaInfo = active_metaInfo()
local dim = DimRadial(defPoint1, middleOfText, 5, 0, 1, 1, text, defPoint2, 1, layer, metaInfo)
dim:setId(self.dimRadial_id)
return dim
@@ -71,9 +71,9 @@ function EllipseOperations:newData(data)
end
function EllipseOperations:getEllipse(center, majorPoint, minorRadius, startAngle, endAngle)
local d = active_widget():document()
local layer = active_layer()
local e = Ellipse(center, majorPoint, minorRadius, startAngle, endAngle, false, layer)
local metaInfo = active_metaInfo()
local e = Ellipse(center, majorPoint, minorRadius, startAngle, endAngle, false, layer, metaInfo)
e:setId(self.ellipse_id)
return e
@@ -70,16 +70,16 @@ function LineOperations:createTempLine(point)
end
function LineOperations:createLine(p1, p2)
local d = active_widget():document()
local layer = active_layer()
local l
if(self.length == nil) then
l = Line(p1, p2, layer, active_metaInfo())
else
local metaInfo = active_metaInfo()
if(self.length ~= nil) then
local angle = p1:angleTo(p2)
local relativeCoordinate = Coordinate._fromAngle(angle):mulDouble(self.length)
l = Line(p1, p1:add(relativeCoordinate), layer, active_metaInfo())
p2 = p1:add(relativeCoordinate)
end
local l = Line(p1, p2, layer, metaInfo)
l:setId(self.line_id)
return l
@@ -59,9 +59,9 @@ end
function LWPolylineOperations:getLWPolyline(vertexes)
if(#vertexes > 1) then
local d = active_widget():document()
local layer = active_layer()
local lwp = LWPolyline(vertexes, 1, 1, 1, false, Coord(0,0), layer, MetaInfo())
local metaInfo = active_metaInfo()
local lwp = LWPolyline(vertexes, 1, 1, 1, false, Coord(0,0), layer, metaInfo)
lwp:setId(self.lwPolyline_id)
return lwp
@@ -47,10 +47,9 @@ function SplineOperations:newPoint(point)
end
function SplineOperations:getSpline(points, degree)
local d = active_widget():document()
local layer = active_layer()
local s = Spline(points, {}, {}, degree, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, layer, MetaInfo())
local metaInfo = active_metaInfo()
local s = Spline(points, {}, {}, degree, false, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, layer, metaInfo)
s:setId(self.spline_id)

0 comments on commit 8d90ff1

Please sign in to comment.