1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 23:28:06 +02:00

Merge pull request #7633 from timvandermeij/interactive-forms-tx-flags

Text widget annotations: support read-only/multiline fields and improve testing
This commit is contained in:
Tim van der Meij 2016-09-17 17:19:47 +02:00 committed by GitHub
commit f062695d62
13 changed files with 150 additions and 25 deletions

View file

@ -43,7 +43,8 @@
position: absolute;
}
.annotationLayer .textWidgetAnnotation input {
.annotationLayer .textWidgetAnnotation input,
.annotationLayer .textWidgetAnnotation textarea {
background-color: rgba(0, 54, 255, 0.13);
border: 1px solid transparent;
box-sizing: border-box;
@ -54,6 +55,18 @@
width: 100%;
}
.annotationLayer .textWidgetAnnotation textarea {
font: message-box;
font-size: 9px;
resize: none;
}
.annotationLayer .textWidgetAnnotation input[disabled],
.annotationLayer .textWidgetAnnotation textarea[disabled] {
background: none;
border: 1px solid transparent;
}
.annotationLayer .popupAnnotation {
display: block !important;
}

View file

@ -250,4 +250,5 @@
!annotation-squiggly.pdf
!annotation-highlight.pdf
!annotation-fileattachment.pdf
!annotation-text-widget.pdf
!zero_descent.pdf

Binary file not shown.

View file

@ -3151,6 +3151,13 @@
"type": "eq",
"annotations": true
},
{ "id": "annotation-text-widget-forms",
"file": "pdfs/annotation-text-widget.pdf",
"md5": "cc9672539ad5b837152a9c6961e5f106",
"rounds": 1,
"type": "eq",
"forms": true
},
{ "id": "issue6108",
"file": "pdfs/issue6108.pdf",
"md5": "8961cb55149495989a80bf0487e0f076",

View file

@ -469,7 +469,8 @@ describe('Annotation layer', function() {
textWidgetDict = null;
});
it('should handle unknown text alignment and maximum length', function() {
it('should handle unknown text alignment, maximum length and flags',
function() {
var textWidgetRef = new Ref(124, 0);
var xref = new XRefMock([
{ ref: textWidgetRef, data: textWidgetDict, }
@ -478,11 +479,15 @@ describe('Annotation layer', function() {
var textWidgetAnnotation = annotationFactory.create(xref, textWidgetRef);
expect(textWidgetAnnotation.data.textAlignment).toEqual(null);
expect(textWidgetAnnotation.data.maxLen).toEqual(null);
expect(textWidgetAnnotation.data.readOnly).toEqual(false);
expect(textWidgetAnnotation.data.multiLine).toEqual(false);
});
it('should not set invalid text alignment and maximum length', function() {
it('should not set invalid text alignment, maximum length and flags',
function() {
textWidgetDict.set('Q', 'center');
textWidgetDict.set('MaxLen', 'five');
textWidgetDict.set('Ff', 'readonly');
var textWidgetRef = new Ref(43, 0);
var xref = new XRefMock([
@ -492,11 +497,15 @@ describe('Annotation layer', function() {
var textWidgetAnnotation = annotationFactory.create(xref, textWidgetRef);
expect(textWidgetAnnotation.data.textAlignment).toEqual(null);
expect(textWidgetAnnotation.data.maxLen).toEqual(null);
expect(textWidgetAnnotation.data.readOnly).toEqual(false);
expect(textWidgetAnnotation.data.multiLine).toEqual(false);
});
it('should set valid text alignment and maximum length', function() {
it('should set valid text alignment, maximum length and flags',
function() {
textWidgetDict.set('Q', 1);
textWidgetDict.set('MaxLen', 20);
textWidgetDict.set('Ff', 4097);
var textWidgetRef = new Ref(84, 0);
var xref = new XRefMock([
@ -506,6 +515,8 @@ describe('Annotation layer', function() {
var textWidgetAnnotation = annotationFactory.create(xref, textWidgetRef);
expect(textWidgetAnnotation.data.textAlignment).toEqual(1);
expect(textWidgetAnnotation.data.maxLen).toEqual(20);
expect(textWidgetAnnotation.data.readOnly).toEqual(true);
expect(textWidgetAnnotation.data.multiLine).toEqual(true);
});
});