Merge branch 'master' into develop
# Conflicts: # xpcPlugin/XPlaneConnect/mac.xpl # xpcPlugin/xpcPlugin.xcodeproj/project.pbxproj
This commit is contained in:
15
TestScripts/MATLAB Tests/getCTRLTest.m
Normal file
15
TestScripts/MATLAB Tests/getCTRLTest.m
Normal file
@@ -0,0 +1,15 @@
|
||||
function getCTRLTest()
|
||||
%GETCTRLTEST Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
addpath('../../MATLAB')
|
||||
import XPlaneConnect.*
|
||||
|
||||
values = [10.0, 5.0, -5.0, 0.8, 1.0, 0.5, -1.5];
|
||||
sendCTRL(values, 0);
|
||||
actual = getCTRL(0);
|
||||
|
||||
assert(isequal(length(actual), length(values)));
|
||||
for i = 1:length(actual)
|
||||
assert(abs(actual(i) - values(i)) <1e-4)
|
||||
end
|
||||
end
|
||||
17
TestScripts/MATLAB Tests/getPOSITest.m
Normal file
17
TestScripts/MATLAB Tests/getPOSITest.m
Normal file
@@ -0,0 +1,17 @@
|
||||
function getPOSITest()
|
||||
%GETCTRLTEST Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
addpath('../../MATLAB')
|
||||
import XPlaneConnect.*
|
||||
|
||||
values = [ 37.524, -122.06899, 2500, 45, -45, 15, 1 ];
|
||||
pauseSim(1);
|
||||
sendPOSI(values, 0);
|
||||
actual = getPOSI(0);
|
||||
pauseSim(0);
|
||||
|
||||
assert(isequal(length(actual), length(values)));
|
||||
for i = 1:length(actual)
|
||||
assert(abs(actual(i) - values(i)) <1e-4)
|
||||
end
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
function CTRLTest( )
|
||||
function sendCTRLTest( )
|
||||
%CTRLTest Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
%% Test player aircraft
|
||||
@@ -1,4 +1,4 @@
|
||||
function POSITest( )
|
||||
function sendPOSITest( )
|
||||
%POSITest Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
addpath('../../MATLAB')
|
||||
26
TestScripts/MATLAB Tests/sendVIEWTest.m
Normal file
26
TestScripts/MATLAB Tests/sendVIEWTest.m
Normal file
@@ -0,0 +1,26 @@
|
||||
function sendVIEWTest()
|
||||
%% Setup
|
||||
addpath('../../MATLAB')
|
||||
import XPlaneConnect.*
|
||||
|
||||
if ~exist('gov.nasa.xpc.ViewType', 'class')
|
||||
[folder, ~, ~] = fileparts(which('XPlaneConnect.openUDP'));
|
||||
javaaddpath(fullfile(folder, 'XPlaneConnect.jar'));
|
||||
end
|
||||
|
||||
dref = 'sim/graphics/view/view_type';
|
||||
fwd = 1000;
|
||||
chase = 1017;
|
||||
|
||||
%% Excecute
|
||||
sendVIEW(gov.nasa.xpc.ViewType.Forwards);
|
||||
result = getDREFs(dref);
|
||||
assert(isequal(result, fwd))
|
||||
|
||||
sendVIEW(gov.nasa.xpc.ViewType.Chase);
|
||||
result = getDREFs(dref);
|
||||
assert(isequal(result, chase))
|
||||
|
||||
|
||||
end
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
addpath('../../MATLAB')
|
||||
import XPlaneConnect.*
|
||||
|
||||
testsPassed=0;
|
||||
testsFailed=0;
|
||||
if ismac()
|
||||
@@ -15,12 +18,16 @@ theTests = {{@openCloseTest, 'Open/Close Test', 0},...
|
||||
{@getDREFsTest,'Request DREF Test', 0},...
|
||||
{@sendDREFTest,'Send DREF Test', 0},...
|
||||
{@DATATest,'DATA Test', 0},...
|
||||
{@CTRLTest,'CTRL Test', 0},...
|
||||
{@POSITest,'POSI Test', 0},...
|
||||
{@sendCTRLTest,'sendCTRL Test', 0},...
|
||||
{@getCTRLTest,'getCTRL Test', 0},...
|
||||
{@sendPOSITest,'sendPOSI Test', 0},...
|
||||
{@getPOSITest,'getPOSI Test', 0},...
|
||||
{@sendWYPTTest,'WYPT Test', 0},...
|
||||
{@sendVIEWTest,'VIEW Test', 0},...
|
||||
{@pauseTest,'Pause Test', 0},...
|
||||
{@setConnTest, 'setConn Test', 0}};
|
||||
|
||||
socket = openUDP();
|
||||
for i=1:length(theTests)
|
||||
fprintf(['Test ',num2str(i),': ',theTests{i}{2},' - ']);
|
||||
try
|
||||
@@ -35,6 +42,7 @@ for i=1:length(theTests)
|
||||
testsFailed = testsFailed + 1;
|
||||
end
|
||||
end
|
||||
closeUDP(socket);
|
||||
|
||||
disp('Results Summary:');
|
||||
fprintf('Passed: %i\tFailed: %i\n',testsPassed, testsFailed);
|
||||
Reference in New Issue
Block a user