You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: test.rs
    path of file: ./repos/ruffle/core/src/html
    
    the code of the file until where you have to start completion: //! Tests for HTML module

use crate::html::dimensions::{BoxBounds, Position, Size};
use crate::html::text_format::{FormatSpans, TextFormat, TextSpan};
use crate::string::{WStr, WString};
use swf::{Rectangle, Twips};

#[test]
fn position_add() {
    let pos1 = Position::from((12, 31));
    let pos2 = Position::from((1, -160));

    assert_eq!(pos1 + pos2, (13, -129).into());
}

#[test]
fn position_add_assign() {
    let mut pos1 = Position::from((12, 31));
    let pos2 = Position::from((1, -160));

    pos1 += pos2;

    assert_eq!(pos1, (13, -129).into());
}

#[test]
fn into_swf_rectangle() {
    let pos = Position::from((Twips::new(3), Twips::new(5)));
    let size = Size::from((Twips::new(20), Twips::new(80)));
    let bounds = BoxBounds::from_position_and_size(pos, size);
    let rect: Rectangle<Twips> = bounds.into();

    assert_eq!(
        rect,
        Rectangle {
            x_min: Twips::new(3),
            x_max: Twips::new(23),
            y_min: Twips::new(5),

    
fn formatspans_get_text_format() {
    let tf1 = TextFormat {
        font: Some(WString::from_utf8("same!")),
        size: Some(12.0),
        ..Default::default()
    };

    let tf2 = TextFormat {
        font: Some(WString::from_utf8("difference!")),
        size: Some(12.0),
        ..Default::default()
    };

    let fs = FormatSpans::from_str_and_spans(
        WStr::from_units(b"abcdefghi"),
        &[
            TextSpan::with_length_and_format(2, &tf1),
            TextSpan::with_length_and_format(3, &tf1),
            TextSpan::with_length_and_format(1, &tf2),
            TextSpan::with_length_and_format(1, &tf1),
            TextSpan::with_length_and_format(2, &tf1),
        ],
    );

    let first_span = fs.get_text_format(0, 1);
    assert!(first_span.font.is_some());
    assert_eq!(tf1.size, first_span.size);

    let before_the_break = fs.get_text_format(0, 5);
    assert!(before_the_break.font.is_some());
    assert_eq!(tf1.size, before_the_break.size);

    let all = fs.get_text_format(0, 100);
    assert!(all.font.is_none());
    assert_eq!(tf1.size, all.size);
}