Adds size test for radiobutton and checkbox (#207)

This commit is contained in:
Atul R 2019-11-19 01:31:22 +01:00 committed by GitHub
parent 97c67219e2
commit dfdb1907c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import { QCheckBox } from '../QCheckBox';
import { QIcon } from '../../QtGui/QIcon';
import path from 'path';
import { QSize } from '../../QtCore/QSize';
describe('QCheckBox', () => {
it('instantiate a button instance', () => {
@ -26,4 +27,14 @@ describe('QCheckBox', () => {
button.setChecked(false);
expect(button.isChecked()).toEqual(false);
});
it('setIconSize', () => {
const button = new QCheckBox();
const testImagePath = path.resolve(__dirname, 'assets', 'nodegui.png');
const icon = new QIcon(testImagePath);
button.setIcon(icon);
button.setIconSize(new QSize(111, 111));
const returnedSize = button.iconSize();
expect(returnedSize.width()).toBe(111);
expect(returnedSize.height()).toBe(111);
});
});

View File

@ -1,6 +1,7 @@
import { QRadioButton } from '../QRadioButton';
import { QIcon } from '../../QtGui/QIcon';
import path from 'path';
import { QSize } from '../../QtCore/QSize';
describe('QRadioButton', () => {
it('instantiate a button instance', () => {
@ -19,4 +20,14 @@ describe('QRadioButton', () => {
button.setIcon(icon);
expect(QIcon.fromQVariant(button.property('icon')).cacheKey()).toEqual(icon.cacheKey());
});
it('setIconSize', () => {
const button = new QRadioButton();
const testImagePath = path.resolve(__dirname, 'assets', 'nodegui.png');
const icon = new QIcon(testImagePath);
button.setIcon(icon);
button.setIconSize(new QSize(111, 111));
const returnedSize = button.iconSize();
expect(returnedSize.width()).toBe(111);
expect(returnedSize.height()).toBe(111);
});
});