var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
(function (factory) {
    if (typeof module === "object" && typeof module.exports === "object") {
        var v = factory(require, exports);
        if (v !== undefined) module.exports = v;
    }
    else if (typeof define === "function" && define.amd) {
        define(["require", "exports", "@web-atoms/unit-test/dist/Assert", "@web-atoms/unit-test/dist/Test", "@web-atoms/unit-test/dist/TestItem", "../../core/Colors"], factory);
    }
})(function (require, exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var Assert_1 = require("@web-atoms/unit-test/dist/Assert");
    var Test_1 = require("@web-atoms/unit-test/dist/Test");
    var TestItem_1 = require("@web-atoms/unit-test/dist/TestItem");
    var Colors_1 = require("../../core/Colors");
    var TestCase = /** @class */ (function (_super) {
        __extends(TestCase, _super);
        function TestCase() {
            return _super !== null && _super.apply(this, arguments) || this;
        }
        TestCase.prototype.parse = function () {
            Assert_1.default.equals("#ff0000", Colors_1.default.red.colorCode);
            Assert_1.default.equals("#ff0000", Colors_1.default.parse("red").colorCode);
            Assert_1.default.equals("#ff0000", Colors_1.default.rgba(255, 0, 0).colorCode);
            Assert_1.default.equals("#ff0000", Colors_1.default.rgba(255, 0, 0).colorCode);
            Assert_1.default.equals("#ff0000", Colors_1.default.rgba(255, 0, 0).toString());
            var ci = new Colors_1.ColorItem(0, 255, 0);
            Assert_1.default.equals("#00ff00", ci.colorCode);
            ci = new Colors_1.ColorItem(0, 255, 0, 0);
            Assert_1.default.equals("rgba(0,255,0,0)", ci.colorCode);
            ci = new Colors_1.ColorItem(0, 255, 0, 0.5);
            Assert_1.default.equals("rgba(0,255,0,0.5)", ci.colorCode);
            var r = Colors_1.default.parse("#ff0000");
            Assert_1.default.equals(255, r.red);
            Assert_1.default.equals(0, r.green);
            Assert_1.default.equals(0, r.blue);
            var white = Colors_1.default.parse("#fff");
            Assert_1.default.equals(255, white.red);
            Assert_1.default.equals(255, white.blue);
            Assert_1.default.equals(255, white.green);
            var whiteWithAlpha = Colors_1.default.parse("#ff0000ff");
            Assert_1.default.equals(255, whiteWithAlpha.red);
            Assert_1.default.equals(0, whiteWithAlpha.green);
            Assert_1.default.equals(0, whiteWithAlpha.blue);
            var rgba = Colors_1.default.parse("rgba(100,200,255,0.5)");
            Assert_1.default.equals(100, rgba.red);
            Assert_1.default.equals(200, rgba.green);
            Assert_1.default.equals(255, rgba.blue);
            Assert_1.default.equals(0.5, rgba.alpha);
            var rgba1 = rgba.withAlphaPercent(0.2);
            Assert_1.default.equals(0.2, rgba1.alpha);
            var rgb = Colors_1.default.parse("rgb(100,200,255)");
            Assert_1.default.equals(100, rgb.red);
            Assert_1.default.equals(200, rgb.green);
            Assert_1.default.equals(255, rgb.blue);
            Assert_1.default.throws("Invalid color format aaa", function () { return Colors_1.default.parse("aaa"); });
            Assert_1.default.throws("Unknown color format aaa", function () { return new Colors_1.ColorItem("aaa"); });
        };
        __decorate([
            Test_1.default,
            __metadata("design:type", Function),
            __metadata("design:paramtypes", []),
            __metadata("design:returntype", void 0)
        ], TestCase.prototype, "parse", null);
        return TestCase;
    }(TestItem_1.default));
    exports.TestCase = TestCase;
});
//# sourceMappingURL=ColorTests.js.map