Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • cse493x-24sp/cse493x-24sp-tests
  • wongyh/cse493x-24sp-tests
2 results
Show changes
Commits on Source (9)
...@@ -21,7 +21,7 @@ CHAPTER_DEADLINES = { ...@@ -21,7 +21,7 @@ CHAPTER_DEADLINES = {
"chapter2": datetime.datetime(2024, 4, 8, tzinfo=PDT), "chapter2": datetime.datetime(2024, 4, 8, tzinfo=PDT),
"chapter3": datetime.datetime(2024, 4, 15, tzinfo=PDT), "chapter3": datetime.datetime(2024, 4, 15, tzinfo=PDT),
"chapter4": datetime.datetime(2024, 4, 22, tzinfo=PDT), "chapter4": datetime.datetime(2024, 4, 22, tzinfo=PDT),
"chapter5": datetime.datetime(2024, 4, 20, tzinfo=PDT), "chapter5": datetime.datetime(2024, 4, 29, tzinfo=PDT),
"chapter6": datetime.datetime(2024, 5, 6, tzinfo=PDT), "chapter6": datetime.datetime(2024, 5, 6, tzinfo=PDT),
"chapter7": datetime.datetime(2024, 5, 13, tzinfo=PDT), "chapter7": datetime.datetime(2024, 5, 13, tzinfo=PDT),
"chapter8": datetime.datetime(2024, 5, 20, tzinfo=PDT), "chapter8": datetime.datetime(2024, 5, 20, tzinfo=PDT),
...@@ -93,6 +93,7 @@ CURRENT_TESTS = { ...@@ -93,6 +93,7 @@ CURRENT_TESTS = {
"chapter8-exercise-check-boxes-tests.md", "chapter8-exercise-check-boxes-tests.md",
"chapter8-exercise-get-forms-tests.md", "chapter8-exercise-get-forms-tests.md",
"chapter8-exercise-rich-buttons-tests.md", "chapter8-exercise-rich-buttons-tests.md",
"chapter8-exercise-tab-tests.md",
], ],
"chapter9": ["chapter9-base-tests.md", "chapter9": ["chapter9-base-tests.md",
"chapter9-exercise-create-element-tests.md", "chapter9-exercise-create-element-tests.md",
......
...@@ -21,6 +21,27 @@ Make sure you have the expected default values for `HSTEP`, `VSTEP`, ...@@ -21,6 +21,27 @@ Make sure you have the expected default values for `HSTEP`, `VSTEP`,
>>> browser.HEIGHT >>> browser.HEIGHT
600 600
Notes
=====
You might need to modify the `__repr__` method on `Text` and `Tag`
if you factored your project into multiple files: (This is especially
true if you see a mismatched output of the form `<layout.Tag object at ...>`)
```
class Text:
...
def __repr__(self):
return "Text('{}')".format(self.text)
class Tag:
...
def __repr__(self):
return "Tag('{}')".format(self.tag)
```
Testing `lex` Testing `lex`
------------- -------------
......
...@@ -16,8 +16,7 @@ Testing boilerplate: ...@@ -16,8 +16,7 @@ Testing boilerplate:
>>> _ = wbemocks.ssl.patch().start() >>> _ = wbemocks.ssl.patch().start()
>>> _ = wbemocks.patch_canvas() >>> _ = wbemocks.patch_canvas()
>>> import browser >>> import browser
>>> browser.WIDTH >>> browser.set_parameters(WIDTH=800)
800
>>> def test_layout(text): >>> def test_layout(text):
... dl = browser.Layout(browser.lex(text)).display_list ... dl = browser.Layout(browser.lex(text)).display_list
... return wbemocks.normalize_display_list(dl) ... return wbemocks.normalize_display_list(dl)
......
...@@ -43,7 +43,7 @@ If the word fits without splitting then no literal hyphens are present. ...@@ -43,7 +43,7 @@ If the word fits without splitting then no literal hyphens are present.
When a soft hyphen is replaced with a literal hyphen you need to check that the When a soft hyphen is replaced with a literal hyphen you need to check that the
text with the hyphen fits on the line. text with the hyphen fits on the line.
>>> browser.WIDTH = 90 >>> browser.set_parameters(WIDTH=90)
>>> test_layout("a\N{soft hyphen}b\N{soft hyphen}c\N{soft hyphen}d\N{soft hyphen}e") #doctest: +NORMALIZE_WHITESPACE >>> test_layout("a\N{soft hyphen}b\N{soft hyphen}c\N{soft hyphen}d\N{soft hyphen}e") #doctest: +NORMALIZE_WHITESPACE
[(13.0, 21.0, 'abc-', Font size=16 weight=normal slant=roman style=None), [(13.0, 21.0, 'abc-', Font size=16 weight=normal slant=roman style=None),
(13.0, 41.0, 'de', Font size=16 weight=normal slant=roman style=None)] (13.0, 41.0, 'de', Font size=16 weight=normal slant=roman style=None)]
...@@ -51,7 +51,7 @@ When a soft hyphen is replaced with a literal hyphen you need to check that the ...@@ -51,7 +51,7 @@ When a soft hyphen is replaced with a literal hyphen you need to check that the
Sometimes a word may be so long that it needs to be split multiple times. Sometimes a word may be so long that it needs to be split multiple times.
>>> browser.WIDTH = 122 >>> browser.set_parameters(WIDTH=122)
>>> test_layout("multi\N{soft hyphen}word\N{soft hyphen}split") #doctest: +NORMALIZE_WHITESPACE >>> test_layout("multi\N{soft hyphen}word\N{soft hyphen}split") #doctest: +NORMALIZE_WHITESPACE
[(13.0, 21.0, 'multi-', Font size=16 weight=normal slant=roman style=None), [(13.0, 21.0, 'multi-', Font size=16 weight=normal slant=roman style=None),
(13.0, 41.0, 'word-', Font size=16 weight=normal slant=roman style=None), (13.0, 41.0, 'word-', Font size=16 weight=normal slant=roman style=None),
......
...@@ -13,7 +13,7 @@ interaction. ...@@ -13,7 +13,7 @@ interaction.
Note that we aren't mocking `dukpy`. It should just run JavaScript normally! Note that we aren't mocking `dukpy`. It should just run JavaScript normally!
Testing basic <script> support Testing basic \<script> support
============================== ==============================
The browser should download JavaScript code mentioned in a `<script>` tag: The browser should download JavaScript code mentioned in a `<script>` tag:
......
...@@ -87,7 +87,7 @@ Replace the id with something that has a different id. ...@@ -87,7 +87,7 @@ Replace the id with something that has a different id.
Traceback (most recent call last): Traceback (most recent call last):
... ...
_dukpy.JSRuntimeError: ReferenceError: identifier 'one' undefined _dukpy.JSRuntimeError: ReferenceError: identifier 'one' undefined
at [anon] (duk_js_var.c:1239) internal ...
at eval (eval:1) preventsyield at eval (eval:1) preventsyield
>>> js.run("replacement;") >>> js.run("replacement;")
{'handle': 2} {'handle': 2}
...@@ -110,19 +110,19 @@ Empty the document of ids. ...@@ -110,19 +110,19 @@ Empty the document of ids.
Traceback (most recent call last): Traceback (most recent call last):
... ...
_dukpy.JSRuntimeError: ReferenceError: identifier 'alice' undefined _dukpy.JSRuntimeError: ReferenceError: identifier 'alice' undefined
at [anon] (duk_js_var.c:1239) internal ...
at eval (eval:1) preventsyield at eval (eval:1) preventsyield
>>> js.run("one;") >>> js.run("one;")
Traceback (most recent call last): Traceback (most recent call last):
... ...
_dukpy.JSRuntimeError: ReferenceError: identifier 'one' undefined _dukpy.JSRuntimeError: ReferenceError: identifier 'one' undefined
at [anon] (duk_js_var.c:1239) internal ...
at eval (eval:1) preventsyield at eval (eval:1) preventsyield
>>> js.run("replacement;") >>> js.run("replacement;")
Traceback (most recent call last): Traceback (most recent call last):
... ...
_dukpy.JSRuntimeError: ReferenceError: identifier 'replacement' undefined _dukpy.JSRuntimeError: ReferenceError: identifier 'replacement' undefined
at [anon] (duk_js_var.c:1239) internal ...
at eval (eval:1) preventsyield at eval (eval:1) preventsyield
>>> browser.print_tree(this_browser.active_tab.document) >>> browser.print_tree(this_browser.active_tab.document)
DocumentLayout() DocumentLayout()
......
...@@ -146,10 +146,10 @@ class socket: ...@@ -146,10 +146,10 @@ class socket:
cls.URLs[url] = [method, response, body] cls.URLs[url] = [method, response, body]
@classmethod @classmethod
def respond_200(cls, url, body, **kwargs): def respond_200(cls, url, response_body, **kwargs):
response = ("HTTP/1.0 200 OK\r\n" + response = ("HTTP/1.0 200 OK\r\n" +
"\r\n" + "\r\n" +
body).encode() response_body).encode()
cls.respond(url, response, **kwargs) cls.respond(url, response, **kwargs)
@classmethod @classmethod
......