1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-25 21:33:04 +04:00
Files
opencv/modules/core/misc/objc/test/KeyPointTest.swift
T
Giles Payne 02385472b6 Merge pull request #17165 from komakai:objc-binding
Objc binding

* Initial work on Objective-C wrapper

* Objective-C generator script; update manually generated wrappers

* Add Mat tests

* Core Tests

* Imgproc wrapper generation and tests

* Fixes for Imgcodecs wrapper

* Miscellaneous fixes. Swift build support

* Objective-C wrapper build/install

* Add Swift wrappers for videoio/objdetect/feature2d

* Framework build;iOS support

* Fix toArray functions;Use enum types whenever possible

* Use enum types where possible;prepare test build

* Update test

* Add test runner scripts for iOS and macOS

* Add test scripts and samples

* Build fixes

* Fix build (cmake 3.17.x compatibility)

* Fix warnings

* Fix enum name conflicting handling

* Add support for document generation with Jazzy

* Swift/Native fast accessor functions

* Add Objective-C wrapper for calib3d, dnn, ml, photo and video modules

* Remove IntOut/FloatOut/DoubleOut classes

* Fix iOS default test platform value

* Fix samples

* Revert default framework name to opencv2

* Add converter util functions

* Fix failing test

* Fix whitespace

* Add handling for deprecated methods;fix warnings;define __OPENCV_BUILD

* Suppress cmake warnings

* Reduce severity of "jazzy not found" log message

* Fix incorrect #include of compatibility header in ios.h

* Use explicit returns in subscript/get implementation

* Reduce minimum required cmake version to 3.15 for Objective-C/Swift binding
2020-06-08 18:32:53 +00:00

60 lines
1.8 KiB
Swift

//
// KeyPointTest.swift
//
// Created by Giles Payne on 2020/01/31.
//
import XCTest
import OpenCV
class KeyPointTest: OpenCVTestCase {
let angle:Float = 30
let classId:Int32 = 1
let octave:Int32 = 1
let response:Float = 2.0
let size:Float = 3.0
let x:Float = 1.0
let y:Float = 2.0
func testKeyPoint() {
let keyPoint = KeyPoint()
assertPoint2fEquals(Point2f(x: 0, y: 0), keyPoint.pt, OpenCVTestCase.FEPS)
}
func testKeyPointFloatFloatFloat() {
let keyPoint = KeyPoint(x: x, y: y, size: size)
assertPoint2fEquals(Point2f(x: 1, y: 2), keyPoint.pt, OpenCVTestCase.FEPS)
}
func testKeyPointFloatFloatFloatFloat() {
let keyPoint = KeyPoint(x: x, y: y, size: size, angle: 10.0)
XCTAssertEqual(10.0, keyPoint.angle);
}
func testKeyPointFloatFloatFloatFloatFloat() {
let keyPoint = KeyPoint(x: x, y: y, size: size, angle: 1.0, response: 1.0)
XCTAssertEqual(1.0, keyPoint.response)
}
func testKeyPointFloatFloatFloatFloatFloatInt() {
let keyPoint = KeyPoint(x: x, y: y, size: size, angle: 1.0, response: 1.0, octave: 1)
XCTAssertEqual(1, keyPoint.octave)
}
func testKeyPointFloatFloatFloatFloatFloatIntInt() {
let keyPoint = KeyPoint(x: x, y: y, size: size, angle: 1.0, response: 1.0, octave: 1, classId: 1)
XCTAssertEqual(1, keyPoint.classId)
}
func testToString() {
let keyPoint = KeyPoint(x: x, y: y, size: size, angle: angle, response: response, octave: octave, classId: classId)
let actual = "\(keyPoint)"
let expected = "KeyPoint { pt: Point2f {1.000000,2.000000}, size: 3.000000, angle: 30.000000, response: 2.000000, octave: 1, classId: 1}"
XCTAssertEqual(expected, actual)
}
}